Manually compile and configure Bost 1.57.0 in CodeBlocks in Ubuntu 14.04
Environment: Ubuntu 14.04 32bit, boost_000057_0
Preparations: other function libraries are used in boost. To use the functions in boost, you must first install the libraries that may be missing in the system.
Apt-get install mpi-default-dev # install the mpi Library
Apt-get install libicu-dev # UNICODE Character Set supporting regular expressions
Apt-get install python-dev # If python is needed
Apt-get install libbz2-dev # If compilation error: bzlib. h: No such file or directory appears
After the above function library is installed, You can compile the boost library. Decompress boost_000057_0.tar.gz:
Tar zxvf boost_000057_0.tar.gz
Sudo mv boost_000057_0/usr/local/
Modify permissions:
Chmod-R 755/usr/local/boost_000057
Go to the boost root directory and execute the script:
Sudo./bootstrap. sh
Sudo./bjam -- with-date_time // only compiled date_time
After compilation is completed, configure codeblocks as prompted.
Codeblocks menu bar setting-> compiler-> Search directories
Add:/usr/local/boost_000057_0 under compiler
Add:/usr/local/boost_000057_0/stage/lib under linker
Test code:
# Include <iostream>
# Include <thread>
# Include <chrono>
# Include <clocale>
# Include "boost/date_time/gregorian. hpp"
# Include "boost/date_time/posix_time/posix_time.hpp"
Using namespace std;
Using namespace boost;
Using namespace boost: gregorian;
Using namespace boost: posix_time;
Int main ()
{
Date d = day_clock: local_day ();
Date_facet * dfacet = new date_facet ("% Y % m % d ");
Cout. imbue (locale (cout. getloc (), dfacet ));
Cout <d <endl;
Ptime tp = microsec_clock: local_time ();
Time_facet * tfacet = new time_facet ("% Y: % m: % d: % H: % M: % S % F seconds ");
Cout. imbue (locale (cout. getloc (), tfacet ));
Cout <tp <endl;
Return 0;
}
Output:
For the installation Code: Block in Ubuntu 12.04, see
Use CodeBlocks to compile the Makefile project in Linux
Configure GLUT in CodeBlocks in Ubuntu 13.04
Use the C language to configure the MySQL database CodeBlocks Development Environment
Use CodeBlocks to create a template for Gtkmm development with code prompts