Ubuntu14.04 CodeBlocks manual compilation and configuration Bost1.57.0

Source: Internet
Author: User
Environment: Ubuntu14.0432bit, boost_000057_0 preparation: boost, other function libraries are used, so in order to use the corresponding functions in boost, install the library apt-getinstallmpi-default-dev that may be missing in the system # Install the mpi library apt-getinstalllibicu-dev # UNICODE Character Set apt-getinst that supports regular expressions

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
# Include
# Include
# Include

# 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:

 

Ubuntu 12.04 installation Code: Block See http://www.linuxidc.com/Linux/2012-10/73116.htm

Use CodeBlocks to compile Makefile project http://www.linuxidc.com/Linux/2014-04/100140.htm in Linux

Configure the GLUT http://www.linuxidc.com/Linux/2014-03/99121.htm in CodeBlocks in Ubuntu 13.04

Use C language MySQL database CodeBlocks Development Environment configuration http://www.linuxidc.com/Linux/2013-05/84366.htm

Use CodeBlocks templates do their own Gtkmm development code prompt http://www.linuxidc.com/Linux/2011-06/37164.htm

For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2

This article permanently updates the link address: Http://www.linuxidc.com/Linux/2015-09/122877.htm

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.