Boost.Asio installation issue

血红的双手。 提交于 2019-12-05 04:48:54

Boost.Asio requires the Boost.System library as well; you need to add -lboost_system to your linker command line.

As you add features to your program, you might also need other parts of Boost, like Boost.Thread, Boost.Date_Time, and so on. See http://www.boost.org/doc/libs/1_46_1/doc/html/boost_asio/using.html for details.

I use netbeans so i typed '-lboost_system' in additional lines ! That was a mistake.

Additional lines are put before objects, and because of that i had the same error. Then i found out if i run from console and put -lboost_system at the VERY END everything works greate. At the end i found the right place to set in netbeans (in library not command section) and that field adds it at the end!

Remember, not only counts if you have the library in command ! THE POSITION does count :) Remember to put library at end and verify it :)

Work great:

g++.exe -D_WIN32_WINNT=0x0501 -D__USE_W32_SOCKETS   -c -g -MMD -MP -MF async_client.o.d -o async_client.o async_client.cpp
g++.exe -D_WIN32_WINNT=0x0501 -D__USE_W32_SOCKETS -o async_client async_client.o -lws2_32 -lboost_chrono -lboost_system -lboost_thread

Doesn't work:

g++.exe -D_WIN32_WINNT=0x0501 -D__USE_W32_SOCKETS   -c -g -MMD -MP -MF async_client.o.d -o async_client.o async_client.cpp
g++.exe -D_WIN32_WINNT=0x0501 -D__USE_W32_SOCKETS -lws2_32 -lboost_chrono -lboost_system -lboost_thread -o async_client async_client.o 
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!