Boost C++ Libraries is one of the most highly regarded and expertly designed C++ library projects in the world. It provides many efficient algorithms to help App developers to improve their program. However, the Boost’s official website offers only source files and Build Tools ( Boost JAM ), we must build the suitable Lib according to the compiler ( like GNU GCC Compiler, Borland C++ Compiler or VC++ Compiler ). Althought, there’re many pre-builded destro providered by some unofficial website, most of them are for VC++ Compiler.
Here’s a tutorial for building Boost C++ Lib for MINGW GCC Compiler.
[b] * First of all, Download Boost from the Boost website. You will need the actual Boost package (source) and the Boost Jam package (binary NTx86). Unpack the first package to any location on you harddisk and unpack the file "bjam.exe’’ from the second package to a directory contained in your search path (e.g. "C:\MinGW\bin’’ or “C:\Program Files\CodeBlocks\MinGW\bin”).
- Then open a shell (cmd.exe) and change into the directory you have unpacked the Boost package to. Type the following command:
C:\…\boost_1_35_0\>bjam --toolset=gcc --prefix=C:\Boost install
- While building, it’ll take 30 mins up to couple hours depends on your machine. So be patiant.
- Then Boost C++ Lib will be installed in “C:\Boost\include\boost-version”[/b]
After that. we can use Boost to code for MINGW GCC Compiler in Code::Blocks IDE. Before coding, add the Boost “include” and “lib” into the compiler search dictionary.
- Open the Code::Blocks IDE, then click on “settings” → “compiler and debugger…”, change to “search dictionary” page and add “C:\Boost\include\boost-1_35” into “compiler” page.[/b]
* Then add “C:\Boost\lib” into “Linker” page.
Creat a new Console Application project for C++, click “Project” → “Build options…”. Add the lib you need in your project (e.g. C:\Boost\lib\boost_signals-mgw34-mt-1_35.lib)
Then code following code in main.cpp
[code]// Boost.Signals library
// Copyright Douglas Gregor 2001-2003. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// For more information, see http://www.boost.org
void operator()() const
std::cout << “Hello, World!” << std::endl;
test_main(int, char* )
// Signal with no arguments and a void return value
// Connect a HelloWorld slot
// Call all of the slots
Compilation will be completed.
If you have any question, it’s great to post in comment