当前位置 : 主页 > 编程语言 > c语言 >

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

来源:互联网 收集:自由互联 发布时间:2023-09-03
问题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@@


问题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

-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




【文章原创作者:武汉网站制作公司 http://www.1234xp.com/wuhan.html 网络转载请说明出处】
上一篇:visual studio 生成console的cmd窗口闪现解决
下一篇:没有了
网友评论