undefined reference to symbol 'pthread_mutexattr_settype@@GLIBC_2.2.5'

时间:2021-11-03 05:29:14

编译错误:

/usr/bin/ld: /tmp/ccYWdYju.o: undefined reference to symbol 'pthread_mutexattr_settype@@GLIBC_2.2.5'
/usr/lib64/libpthread.so.0: error adding symbols: DSO missing from command line

collect2: error: ld returned 1 exit status


解决办法:

链接加上  -L../boost/stage/lib -pthread

这是我的编译脚本:g++ Printer.cpp  Client.cpp -o client -lIce -fPIC -rdynamic -L../boost/stage/lib -pthread