undefined reference to symbol 'pthread_mutexattr_settype@@GLIBC_2.2.5&undefined reference to `libico

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/launch_225/article/details/79799868

问题1:

[root@testicehost test]# c++  -o server Printer.o Server.o -L$ICE_HOME/lib -lIce -lIceUtil
/opt/rh/devtoolset-3/root/usr/libexec/gcc/x86_64-redhat-linux/4.9.2/ld: Printer.o: undefined reference to symbol 'pthread_mutexattr_settype@@GLIBC_2.2.5'
//lib64/libpthread.so.0: error adding symbols: DSO missing from command line

collect2: error: ld returned 1 exit status


解决:

加入-lpthread

c++  -o server Printer.o Server.o -L$ICE_HOME/lib -lIce -lIceUtil -lpthread


问题2:

/root/software/ICE/Ice-3.5.1/cpp/lib/libIce.so: undefined reference to `libiconv'
/root/software/ICE/Ice-3.5.1/cpp/lib/libIce.so: undefined reference to `libiconv_close'

/root/software/ICE/Ice-3.5.1/cpp/lib/libIce.so: undefined reference to `libiconv_open'


解决: 加入-liconv (如果没有安装此处下载:https://ftp.gnu.org/pub/gnu/libiconv/)

c++ -o  client Printer.o Client.o -L$ICE_HOME/lib -lIce -lIceUtil -lpthread -liconv




猜你喜欢

转载自blog.csdn.net/launch_225/article/details/79799868