Note that there are some explanatory texts on larger screens.

plurals
  1. POlinker tells me it can't resolve symbols, but they're there?
    primarykey
    data
    text
    <p>I am trying to compile a simple test app using a library I've written. This compiles and runs fine on other machines.</p> <p>I have libroller.so available at /usr/lib. I'm compiling a main.cpp as such:</p> <pre><code>g++ -g3 -Wall -I"../../" -lrt -lroller -o rap main.o </code></pre> <p>It complains of numerous errors such as:</p> <pre><code>/....../main.cpp:51: undefined reference to `Log::i(char const*, ...)' </code></pre> <p>However, I know that these exist in this so:</p> <pre><code>nm -Ca /usr/lib/libroller.so | grep "Log::i" 00000000001f5d50 T Log::i(char const*, ...) 0000000000149530 W Log::i(std::string const&amp;) </code></pre> <p>Both are 64 bit:</p> <pre><code>file /usr/lib/libroller.so /usr/lib/libroller.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped file main.o main.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped </code></pre> <p>Unlike <a href="https://stackoverflow.com/questions/216450/gcc-and-ld-cant-find-exported-symbols-but-theyre-there">GCC and ld can&#39;t find exported symbols...but they&#39;re there!</a> I'm pretty sure these symbols are defined. The same .so works with another using some of the same symbols.</p> <p>EDIT/ANSWER: The order of objects is important. Placing main.o before the libraries was necessary. I'm guessing the linker had no unresolved symbols to deal with until it got to main.o -- which was the last object in its list. I'm still a little confused as to why this worked on other machines for many months...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    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