title: GCC and ld can't find exported symbols...but they're there
body: <p>I have a C++ library and a C++ application trying to use functions and classes exported from the library. The library builds fine and the application compiles but fails to link. The errors I get follow this form:</p>
  
  <blockquote>
    <p>app-source-file.cpp:(.text+0x2fdb): undefined reference to `lib-namespace::GetStatusStr(int)'</p>
  </blockquote>
  
  <p>Classes in the library seem to be resolved just fine by the linker, but free functions and exported data (like a cosine lookup table) invariably result in the above error.</p>
  
  <p>I am using Ubuntu 8.04 (Hardy), and it is up to date with the latest Ubuntu packages.</p>
  
  <p>The command to link the library is (with other libraries removed):</p>
  
  <pre><code>g++ -fPIC -Wall -O3 -shared -Wl,-soname,lib-in-question.so -o ~/project/lib/release/lib-in-question.so
  </code></pre>
  
  <p>The command to link the application is (with other libraries removed):</p>
  
  <pre><code>g++ -fPIC -Wall -O3  -L~/project/lib/release -llib-in-question -o ~/project/release/app-in-question
  </code></pre>
  
  <p>Finally, it appears (as best as I can tell) that the symbols in question are being exported properly:</p>
  
  <pre><code>nm -D ~/project/lib/release/lib-in-question.so | grep GetStatusStr --&gt; U _ZN3lib-namespace12GetStatusStrEi
  </code></pre>