linux – Linked无法找到符号,但读取库并存在符号
发布时间:2020-12-13 19:54:12 所属栏目:Linux 来源:网络整理
导读:我一直在尝试编译我的项目,我得到了未定义的引用错误.例如.: installertest.cpp:(.text+0x9d1): undefined reference to `XmlRpcValue::makeArray()'...installertest.cpp:(.text+0xede): undefined reference to `dbcancel'installertest.cpp:(.text+0xefd
我一直在尝试编译我的项目,我得到了未定义的引用错误.例如.:
installertest.cpp:(.text+0x9d1): undefined reference to `XmlRpcValue::makeArray()' ... installertest.cpp:(.text+0xede): undefined reference to `dbcancel' installertest.cpp:(.text+0xefd): undefined reference to `dbfcmd' installertest.cpp:(.text+0xf0f): undefined reference to `dbsqlexec' installertest.cpp:(.text+0xf2d): undefined reference to `SHA1_Init' ... 我的命令行是: g++ -o installertest -lsybdb -lxmlrpc -lxmlrpc_cpp -lxmlrpc_xmlparse -lxmlrpc_xmltok -lxmlrpc_util -lxmlrpc++ -lxmlrpc_server_cgi -lssl -std=c++0x ContractData.o installertest.o objdump -T显示符号位于.so文件中.例如.: libsybdb.so: ... 0000000000011c30 g DF .text 0000000000000083 Base dbcancel ... /usr/lib/libxmlrpc_cpp.so: ... 0000000000002e78 g DF .text 0000000000000092 Base _ZN11XmlRpcValue9makeArrayEv ... strace显示链接器正在打开和读取库文件: ... [pid 5019] stat("/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libsybdb.so",{st_mode=S_IFREG|0644,st_size=421608,...}) = 0 [pid 5019] open("/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libsybdb.so",O_RDONLY) = 7 [pid 5019] fcntl(7,F_GETFD) = 0 [pid 5019] fcntl(7,F_SETFD,FD_CLOEXEC) = 0 [pid 5019] fstat(7,...}) = 0 [pid 5019] mmap(NULL,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,-1,0) = 0x2b16c200c000 [pid 5019] lseek(7,SEEK_SET) = 0 [pid 5019] read(7,"177ELF211 3 > |