
On Thu, Aug 1, 2013 at 3:15 PM, Philip Bennefall <philip@blastbay.com> wrote:
Hi all,
Up until now I have been developing exclusively with VC++ 2010, and there my project builds just fine and without warnings. However, I am also planning to target Unix so I figured that a first step would be to make sure my project builds with MinGw. I set up my path environment variable to include the location of the MinGw 4.7.0 bin directory, and I built Boost with the following parameters:
b2 variant=release link=static runtime-link=static threading=multi toolset=gcc
Everything seems to be working fine (stage/lib contains all the .a files that I would expect). However, when I attempt to build my program I get tons of errors like the following:
myprog_main.o:myprog_main.cpp:(.text+0x28ef): undefined reference to `__imp___ZN5boost6thread9interruptEv' myprog_main.o:myprog_main.cpp:(.text+0x294f): undefined reference to `__imp___ZNK5boost6thread6get_idEv' myprog_main.o:myprog_main.cpp:(.text+0x295d): undefined reference to `__imp___ZN5boost11this_thread6get_idEv' myprog_main.o:myprog_main.cpp:(.text+0x2973): undefined reference to `__imp___ZN5boost6thread13join_noexceptEv' myprog_main.o:myprog_main.cpp:(.text+0x2981): undefined reference to `__imp___ZN5boost6thread6detachEv' myprog_main.o:myprog_main.cpp:(.text+0x4600): undefined reference to `__imp___ZN5boost11this_thread18interruptible_waitEPvNS_6detail7timeoutE' myprog_main.o:myprog_main.cpp:(.text+0x49c2): undefined reference to `__imp___ZN5boost11this_thread18interruptible_waitEPvNS_6detail7timeoutE' myprog_main.o:myprog_main.cpp:(.text+0x667e): undefined reference to `__imp___ZN5boost11this_thread18interruptible_waitEPvNS_6detail7timeoutE' myprog_main.o:myprog_main.cpp:(.text+0x90a9): undefined reference to `__imp___ZN5boost6thread21start_thread_noexceptEv' myprog_main.o:myprog_main.cpp:(.text+0x9134): undefined reference to `__imp___ZN5boost6thread21start_thread_noexceptEv' myprog_main.o:myprog_main.cpp:(.text+0x917e): undefined reference to `__imp___ZN5boost6thread9interruptEv'
myprog_main.o:myprog_main.cpp:(.text$_ZN5boost6detail11thread_dataINS_3_bi6bind_tIvPFvPN5myprog5themeEENS2_5list1INS2_5valueIS6_EEEEEEED1Ev[boost::detail::thread_data<boost::_bi::bind_t<void, void (*)(myprog::theme*), boost::_bi::list1<boost::_bi::value<myprog::theme*> > >
::~thread_data()]+0x7): undefined reference to `__imp___ZN5boost6detail16thread_data_baseD2Ev' myprog_main.o:myprog_main.cpp:(.text$_ZN5boost6detail11thread_dataINS_3_bi6bind_tIvPFvPN5myprog5themeEENS2_5list1INS2_5valueIS6_EEEEEEED0Ev[boost::detail::thread_data<boost::_bi::bind_t<void, void (*)(myprog::theme*), boost::_bi::list1<boost::_bi::value<myprog::theme*> > > ::~thread_data()]+0xe): undefined reference to `__imp___ZN5boost6detail16thread_data_baseD2Ev' myprog_main.o:myprog_main.cpp:(.text$_ZN5boost6threadD1Ev[boost::thread::~thread()]+0x9): undefined reference to `__imp___ZN5boost6thread6detachEv'
Etc...
I tried to specify -DBOOST_NO_LIB and add all the libraries manually, but no luck. Then I thought that maybe there's a problem with the fact that there are spaces in some of my directory names, so I copied the relevant .a files to the same directory as the program itself but still with no success. At this point, I'm swamped. I have managed to compile MinGw programs in the past that used Boost Thread, so I have no idea why it is not working with this version of Boost. Any suggestions would be highly appreciated.
Your program tries to link with Boost dynamically and you only built static libraries. The errors you listed only refer to Boost.Thread symbols, so I can't tell whether the problem is limited to Boost.Thread or to other Boost libraries as well. Make sure you didn't define BOOST_THREAD_DYN_LINK or BOOST_ALL_DYN_LINK when building your application.