: error adding symbols: DSO missing from command line

写了一个简单的boost测试程序,编译时出现如下错误:

 g++ -std=c++11 test_ssl.cpp  -o test -lboost_system -lboost_thread
/usr/bin/ld: /tmp/ccHdMo8P.o: undefined reference to symbol 'pthread_create@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

其实,直接追加相应的库文件即可。

 g++ -std=c++11 test_ssl.cpp  -o test -lboost_system -lpthread

原文地址:https://www.cnblogs.com/rohens-hbg/p/11868120.html