Manually compile and configure Bost 1.57.0 in CodeBlocks in Ubuntu 14.04

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.