I am trying to compile my project and I get undefined reference
errors. eg:.
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' ...
My command line is:
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
indicates that the characters are in the .so file. eg:.
libsybdb.so: ... 0000000000011c30 g DF .text 0000000000000083 Base dbcancel ... /usr/lib/libxmlrpc_cpp.so: ... 0000000000002e78 g DF .text 0000000000000092 Base _ZN11XmlRpcValue9makeArrayEv ...
strace
shows that library files are opened and read by the linker:
... [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, {st_mode=S_IFREG|0644, st_size=421608, ...}) = 0 [pid 5019] mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b16c200c000 [pid 5019] lseek(7, 0, SEEK_SET) = 0 [pid 5019] read(7, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\237\0\0\0\0\0\0"..., 4096) = 4096 ... [pid 5019] stat("/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libxmlrpc.so", {st_mode=S_IFREG|0644, st_size=80936, ...}) = 0 [pid 5019] open("/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libxmlrpc.so", O_RDONLY) = 8 [pid 5019] fcntl(8, F_GETFD) = 0 [pid 5019] fcntl(8, F_SETFD, FD_CLOEXEC) = 0 [pid 5019] fstat(8, {st_mode=S_IFREG|0644, st_size=80936, ...}) = 0 [pid 5019] mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b16c200d000 [pid 5019] lseek(8, 0, SEEK_SET) = 0 [pid 5019] read(8, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300?\0\0\0\0\0\0"..., 4096) = 4096 ...
All involved files are targeted at x86-64, and the header for C libraries is extern "C"
. I tried everything that I can think of, and he still wonβt get involved.
I even tried to remove all C ++ 11 code and compile without a command line switch, nothing is the same.
My Ubuntu Precise (12.04) system is 64-bit using g ++ (Ubuntu / Linaro 4.6.3-1ubuntu5) 4.6.3 if that helps. All packages were installed from the package manager and development packages were installed.
Edit (2017-05-30) : marked as duplicate https://stackoverflow>
Another question asks why the order of the arguments is important. The argument was not known when the question was asked.
In addition, the previous question does not contain any useful extension, while this question shows the problem.
The previous question can be seen as a useful extension of the answer to this question, but not duplication.