Note that there are some explanatory texts on larger screens.

plurals
  1. POLinked cannot find symbols, but libraries are read and symbols exist
    primarykey
    data
    text
    <p>I've been trying to compile my project and I'm getting <code>undefined reference</code> errors. eg.:</p> <pre><code>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' ... </code></pre> <p>My command-line is:</p> <pre><code>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 </code></pre> <p><code>objdump -T</code> shows that the symbols are in the .so file. eg.:</p> <pre><code>libsybdb.so: ... 0000000000011c30 g DF .text 0000000000000083 Base dbcancel ... /usr/lib/libxmlrpc_cpp.so: ... 0000000000002e78 g DF .text 0000000000000092 Base _ZN11XmlRpcValue9makeArrayEv ... </code></pre> <p><code>strace</code> shows that the library files are being opened and read by the linker:</p> <pre><code>... [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&gt;\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&gt;\0\1\0\0\0\300?\0\0\0\0\0\0"..., 4096) = 4096 ... </code></pre> <p>All files involved are targeted to x86-64 and the header for the C libraries are <code>extern "C"</code>. I have tried everything I can think of and it still won't link.</p> <p>I've even tried removing all C++11 code and compiling without the command-line switch, still nothing.</p> <p>My system is <strong>Ubuntu Precise (12.04) 64-bit</strong> using <strong>g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3</strong> if that helps. All packages were installed from the package manager and development packages are installed.</p> <p><strong>Edit (2017-05-30)</strong>: <em>Marked as duplicate of <a href="https://stackoverflow.com/questions/45135/why-does-the-order-in-which-libraries-are-linked-sometimes-cause-errors-in-gcc_">https://stackoverflow.com/questions/45135/why-does-the-order-in-which-libraries-are-linked-sometimes-cause-errors-in-gcc</em></a><br/> Other question asks why order of arguments is important. Argument order was not known to be an issue when question was asked.<br/> Also, previous question does not contain any helpful expansion, whereas this question shows the issue at hand.<br/> Previous question may be seen as a helpful expansion on the answer to this one, but not a duplication.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload