title: Undefined reference to 'dlsym'
body: <p>I have seen a lot of similar posts, but tried every trick in the book and am still struggling. Everything was working fine, but after installing/removing wireshark with some components/disselectors it all got messed up. I don't remember exactly which libraries/packages got uninstalled, but probably a lot more than I noticed. </p>
  
  <p>If I create a simple main.cpp file like this one:</p>
  
  <pre><code>#include &lt;SQLAPI.h&gt;
  int main()
  {
    SAConnection con;
    return 0;
  }
  </code></pre>
  
  <p>and try</p>
  
  <blockquote>
    <p>g++ main.cpp -lsqlapi -ldl</p>
  </blockquote>
  
  <p>it gives me the following error messages:</p>
  
  <pre><code>/usr/local/lib/libsqlapi.so: undefined reference to `dlsym'
  /usr/local/lib/libsqlapi.so: undefined reference to `dlerror'
  /usr/local/lib/libsqlapi.so: undefined reference to `dlopen'
  /usr/local/lib/libsqlapi.so: undefined reference to `dlclose'
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>I have tried to put -ldl before -lsqlapi as some have suggested that the order is important. If I use gcc instead of g++ the error is:</p>
  
  <pre><code>/usr/bin/ld: /tmp/ccwBI4tj.o: undefined reference to symbol '__gxx_personality_v0@@CXXABI_1.3'
  /usr/lib/x86_64-linux-gnu/libstdc++.so.6: error adding symbols: DSO missing from command line
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>I am able to compile and run the file if SAConnection is removed.</p>
  
  <p>I don't think it has anything to do with SQLAPI, because I experience similar problems with libboost. I don't have a small code example, but when I compile a project that was successfully compiled last week, I get the error:</p>
  
  <pre><code>/usr/bin/ld: debug/components/helloworld/HelloWorld.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv'
  /usr/lib/x86_64-linux-gnu/libboost_system.so.1.53.0: error adding symbols: DSO missing from command line
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>This project is using a Makefile that has been unchanged, so it has to be something on my system that is not correct. I have tried to reinstall build-essential.</p>
  
  <p>Using Ubuntu 64 bit 13.10 with g++ version 4.8.1.</p>