(Solved) Boost compiler errors on Windows (7) using Codeblocks

Found some instructions on

couldn't build it out of the box quite like they said, but I eventually got it compiled doing the following:

had to add "f:\codeblocks\mingw\bin" to sysdm.cpl environment variables path
THEN open command prompt as administrator
then run from boost_1_51_0\tools\build\v2\engine\build.bat

set PATH=<path>;%PATH%

then add this bjam to the
bjam --toolset=gcc "--prefix=<installpath>" install

Now when I compile, just adding the simple .hpp libraries, I get weird errors.

F:\CodeBlocks\include\boost\system\error_code.hpp|214|undefined reference to `boost::system::generic_category()'|

Read somewhere I needed to:

add "$(#boost.lib)\libboost_system-mgw44-1_51.a" into "Other linker options". (varies, depends on what your installation produced).

which got me past this error, but then I get another compiler error

F:\CodeBlocks\include\boost\thread\detail\thread.hpp|186|undefined reference to `_imp___ZN5boost6thread12start_threadEv'|

so I read:
adding #define BOOST_THREAD_USE_LIB before the include statements for the boost headers"

which then gives me this compiler error:

F:\CodeBlocks\include\boost\thread\detail\thread.hpp|186|undefined reference to `boost::thread::start_thread()'|

then I read:

g++ -static -pthread Thread.cpp -lboost_thread

Libraries must be specified after the objects (or sources) that use symbols from those libraries.


g++ main.cpp -lboost_regex

but I don't know how to add this inside codeblocks...

The original instructions (at the top) said to
In your project's build options, highlight the root of your project, select the "Linker settings" tab, and add "boost_*-mgwXX-mt-1_47" to your Link libraries

which I don't know how to do, is the * supposed to be a word (such as system), I get the xx, which should be 44, but I wasn't successful in adding this to the link libraries in it's current form.
for example, if I add boost_*-mgw44-mt-1_51
I get
ld.exe||cannot find -lboost_*-mgw44-mt-1_51
so apparently I'm missing something here.

all my libraries are formatted as such (albeit different names than just chronos)

upon further discovery, on the codeblocks forum, I found some additional instructions


that don't get me past this error

F:\CodeBlocks\include\boost\thread\detail\thread.hpp|186|undefined reference to `boost::thread::start_thread()'|

This lead me to the right direction

g++ -static -pthread Thread.cpp -lboost_thread

So I did this

compiler & debugger
linker settings


depends on libraries needed, which depends on your #includes
Last edited on
Topic archived. No new replies allowed.