Building Boost C++ Libraries for EMMe

From WxWiki
Jump to navigation Jump to search
This article applies to the following versions
Platform MinGW MSYS
Windows 7 64-bits (should work with other windows too) most recent packages as of 2011-04-30 most recent packages as of 2011-04-30
Status: up to date


Related Articles
Eclipse, CDT & MingW & MSYS Setup Guide
HowTo: Install MSYS and MinGW for use with Eclipse CDT

This is a step-by-step guide to build Boost C++ libraries in a Win 7 environment configured for use of Eclipse CDT, MSYS & MinGW (EMMe)

Boost C++ Libraries (usually "boost") is a collection of different libraries that can help you greatly in your software development. Among the different frameworks, you will find a regular expression compiler, a portable multi-threading helper module, some template meta-programming libraries and so on. Some work done in Boost is now included in the new C++11 (or C++0x) standard.


Preparatory Steps

As software versions may change over time, <version> will be used in the guide as a placeholder for the current version number as listed in the Intended for Software Versions section. For example, if boost-1.46.1.tar.gz is the current software version, then the guide may tell you to

  • unpack boost-<version>.tar.gz

Prerequisites & Disk Space

You will need a file archiving software capable of uncompressing gz and tar files. If you build in the EMMe environment, you should have tar and gzip available on the MSYS console and do not need any other software. Because of the way that Boost was compressed, it is recommended that you use bsdtar.

One free GUI software solution is 7-zip (windows executable) direct link.

Intended for Software Versions

To be used only with the following software versions freely available on the web, other versions may or may not work:

Eclipse CDT, MSYS & MinGW environment (EMMe) (1)
- all version according to Eclipse, CDT & MingW & MSYS Setup Guide)
boost_1_46_1.tar.gz (1) direct link (2) - 48.6MB

If you compile all the libraries, you will need up to 1.5GB of hard disk space.

Building Boost C++ Libraries

  • copy boost-<version>.tar.gz to your mingw directory (e.g. "C:\mingw")
  • open an MSYS console
  • execute the following commands
cd /mingw/
tar -xf boost-<version>.tar.gz
cd boost-c-<version>/tools/build/v2/engine/src
  • build Boost.Build, an utility to help in the complete build of Boost
./build.sh mingw
mv bin.ntx86/bjam.exe ../../../../../bjam.exe
cd ../../../../..
  • build the libraries
bjam --toolset=gcc --build-type=complete --prefix=/mingw
bjam --toolset=gcc --build-type=complete --prefix=/mingw install
  • Or choose the modules you want installed :
bjam --toolset=gcc --build-type=complete --prefix=/mingw --with-<module-name>
bjam --toolset=gcc --build-type=complete --prefix=/mingw --with-<module-name> install

Including Boost in your Eclipse project

If you did build modules that need to be linked with your software, you can tell Eclipse to include them.

  • start Eclipse, select the project which you would like to use the Boost module
  • Project -> Properties

In the "Properties for (project name)" window

  • select and then expand "C/C++ Build" in the list on the left (double click or select the "+")

On the left side, in the expanded C/C++ Build section

  • select "Settings"

In the "Settings" -> "Tool settings", on the left side

  • select the "GCC C++ Linker" -> "Libraries"

On the right side, next to "Libraries (-l)",

  • click on the little document icon with a green "+" on it to add a library

In the "Enter Value" window,

  • enter for every modules you need
boost_<module_name>
  • select "OK"
  • select "OK" again to close Project Properties


Done.