开发者

Can't link against Boost.Thread 1.46.1 with MinGW 4.5.2

I've built boost using:

bjam --toolset=gcc --with-thread stage

Whenever I'm trying to actually use Boost.Thread I'm getting undefined references although I link against it. It doesn't happen with other Boost libraries like Regex or System.

>g++ main.cpp -I. -L. -lboost_thread-mgw45-mt-1_46_1
C:\Users\jhasse\AppData\Local\Temp\ccjYfDox.o:main.cpp:(.text+0xf): undefined reference to `_imp___ZN5boost6thread20hardware_concurrencyEv'
collect2: ld returned 1 exit status

Example program:

开发者_开发知识库#include <boost/thread.hpp>
#include <iostream>

int main()
{
    std::cout << boost::thread::hardware_concurrency() << std::endl;
}

What am I doing wrong?


Try adding the compiler option '-DBOOST_THREAD_USE_LIB'

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜