开发者

undefined reference to `boost::system::get_posix_category()'

g++ simple_wget.cpp -lssl -lboost_system -lpthread -lcrypto -lboost_filesystem
/tmp/cc2jNHvk.o: In function `__static_initialization_and_destruction_0(int, int)':
simple_wget.cpp:(.text+0x5eb): undefined reference to `boost::system::get_posix_category()'
simple_wget.cpp:(.text+0x5f5): undefined reference to `boost::system::get_posix_category()'
collect2: ld returned 1 exit status

I know that in boost 1.38 get_posix_categ开发者_开发百科ory() was removed. Help me please, what can i do to resolve this problem?


Adding the -static sounds like a bad idea, you can break other parts of your code with it. To use -static you're linked libraries should be compiled using static, sometimes that doesn't happen.

Undefined reference usually indicates boost_system is not found. Add -I/path/to/boost_system.so/.dylib/.dll and or -L/path/to/boost_system.so/.dylib/.dll

You should probably locate boost_system first.


Issue was resolved by adding -static parameter to g++. Why it works so i don't know.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜