小编Ben*_*all的帖子

链接无法找到符号,但读取库并存在符号

我一直在努力编译我的项目而且我遇到了undefined reference错误.例如.:

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'
...
Run Code Online (Sandbox Code Playgroud)

我的命令行是:

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
Run Code Online (Sandbox Code Playgroud)

objdump -T显示符号位于.so文件中.例如.:

libsybdb.so:
...
0000000000011c30 g    DF .text  0000000000000083  Base        dbcancel
...

/usr/lib/libxmlrpc_cpp.so:
...
0000000000002e78 g    DF .text  0000000000000092  Base        _ZN11XmlRpcValue9makeArrayEv …
Run Code Online (Sandbox Code Playgroud)

linux g++ ld shared-objects

6
推荐指数
1
解决办法
4023
查看次数

标签 统计

g++ ×1

ld ×1

linux ×1

shared-objects ×1