记一次boost的坑

报错:localhost@localhost:/mnt/hgfs/share/boost$ g++ thread.cpp -o thread -lboost_thread -lpthread
/usr/bin/ld: /tmp/ccZcXhWY.o: undefined reference to symbol ‘_ZN5boost6system15system_categoryEv’
//usr/lib/x86_64-linux-gnu/libboost_system.so.1.58.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

这个网上有大量的说法,修改文件的方式什么的。搞了半天,也不行,最后发现动态库没有链接,现在给自己做个笔记:
编译boost/thread/thread.hpp,

g++ thread.cpp -o thread -lboost_thread -lpthread -lboost_system

就是少了-lboost_system这个参数。

发布了197 篇原创文章 · 获赞 68 · 访问量 7万+

猜你喜欢

转载自blog.csdn.net/Travelerwz/article/details/98666902