Configuration of boost in code blocks

Source: Internet
Author: User

The following is successfully implemented in at least boost_000036_0 and boost_000046_1, but not in boost_000047_0.

1.

// ================================================ ======================================

// If You Want To compile your bjam.exe (normally, you need to compile your bjam.exe) and compile it with bjam.exe,

  • Boost 1.36.0 source code compressed files. We recommend that you download the 7zip version: boost_1_36_0.7z ".
  • Boost compilation tool, select the executable file under Windows: boost-jam-3.1.16-1-ntx86.zip (download boost-jam-3.1.16-1-ntx86.zip)

// ================================================ ==================================

// ==================Compile boost

Step 1: Open the "Start" menu, select "run", Enter cmd, enter the console window, and then use the CD command in it to switch to the boost installation Source Path. In this example:

"X: \ TMP \ boost_000036_0", the process is as follows:

X: (Press ENTER)

Cd tmp \ boost_000036_0 (Press ENTER)

Step 2: Continue to the previous step. Enter the following in the console:

Bjam -- show-libraries (Press ENTER)

Step 3: The following output is displayed in the correct case:

The following libraries require building:

-Date_time

-Filesystem

-Function_types

-Graph

-Iostreams

-Math

-MPI

-Program

_ Options

-Python

-RegEx

-Serialization

-Signals

-System

-Test

-Thread

-Wave

Step 4: All boost modules to be compiled are listed here, but we will discard compilation of the following modules: Wave, Mpi, Python, math, and graph. The specific meanings of these modules can be found out if necessary.

Step 5: Continue to the previous step. In the console, enter:

Bjam install -- toolset = GCC -- prefix = "E: \ boost_000036_0" Debug -- without-wave -- without-MPI -- without-Python -- without-math -- without-graph (Press ENTER)

Step 6: Replace the bold part with your own "Boost installation target path ". Other parts are described as follows:

Step 7: -- Two consecutive minus signs, = no leading and trailing spaces are allowed. Except for the path, the parameters are all lowercase letters.

Step 8: -- Toolset indicates that GCC is used for compiling. GCC in mingw32. Therefore, to compile boost correctly, you must have completed the installation of the mingw32 environment in code: blocks in section 2.1 in advance.

Step 9:Debug indicates that the "debug version" is compiled first ".

Step 10:Multiple -- without specifies the modules to be decommissioned.

Step 11:After you press enter, a large number of seemingly strange texts will appear in the console. The following content can be seen at last, indicating that this step is successfully completed:

... Failed updating 2 targets.

... Skipped 31 targets...

... Updated 341 targets...

Step 12:Continue to the previous step and enter:

Bjam install -- toolset = GCC -- prefix = "E: \ boost_000036_0" release -- without-wave -- without-MPI -- without-Python -- without-math -- without-graph (Press ENTER)

Step 13:Changed from "debug" to "release ". Press enter to start the boost library compilation of the release version.

2. configuration in code blocks

2.1 configure boost
Open code: blocks-> Settings-> compiler and debugger... -> Search directory-> Add->... [Add c: \ boost \ boost_1_37_0]-> OK

2.2 add lib
Open code: blocks-> Settings-> compiler and debugger... -> Linker settings-> Add->... [Add whatever you need, such as boost \ Lib \ boost_thread-mgw43-mt.lib]

2.3 Test boost
// Perform a simple test to test whether the installation is correct, rather than test boost integrity.
// The function of the following program is to accept an integer sequence from the terminal, multiply by 3, and then output to the terminal

// Test1.cpp # include <iostream> # include <iterator> # include <algorithm> # include <boost/lambda/Lambda. HPP> int main () {using namespace boost: Lambda; typedef STD: istream_iterator <int> In; STD: for_each (in (STD: CIN ), in (), STD: cout <(_ 1*3) <"") ;}// the following program is output on the terminal [2) // test2.cpp # include <boost/numeric/ublas/vector. HPP> # include <boost/numeric/ublas/matrix. HPP> # include <boost/numeric/ublas/Io. HPP> # include <iostream> using namespace boost: Numeric: ublas; int main () {vector <double> X (2); x (0) = 1; X (1) = 2; matrix <double> A (2, 2); A (0, 0) = 0; A (0, 1) = 1; A (1, 0) = 2; A (1, 1) = 3; vector <double> Y = prod (A, x); STD: cout <Y <STD :: endl; return 0 ;}

Main reference http://www.cnblogs.com/bylikai/archive/2011/01/15/1936293.html

Http://www.cnblogs.com/bylikai/archive/2011/01/15/1936293.html

Http://www.d2school.com/bhcpp_book/2_5.php

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.