title: Undefined symbol in shared library with g++
body: <p>With JVMTI I am developing an agent to profile Java applications. Therefore a shared library libagent.so is compiled. Further I use the Qt framework:</p>
  
  <p>For now it consists only by these two source files:
  <a href="http://pastebin.com/2u0JT3ds" rel="nofollow">agent.cpp</a> and <a href="http://pastebin.com/t8FBLNFK" rel="nofollow">agentserver.cpp</a></p>
  
  <p>However, when starting a Java application with my shared library libagent.so I get the error: <strong>undefined symbol: _ZTV11AgentServer (./libagent.so)</strong></p>
  
  <p>When I run ldd I get the same dependency problem:</p>
  
  <pre><code>ldd -d libagent.so 
  linux-vdso.so.1 =&gt;  (0x00007fffeb333000)
  libstdc++.so.6 =&gt; /usr/lib/libstdc++.so.6 (0x00007f8b6731b000)
  libm.so.6 =&gt; /lib/libm.so.6 (0x00007f8b67098000)
  libgcc_s.so.1 =&gt; /lib/libgcc_s.so.1 (0x00007f8b66e81000)
  libc.so.6 =&gt; /lib/libc.so.6 (0x00007f8b66afe000)
  /lib64/ld-linux-x86-64.so.2 (0x00007f8b67844000)
  undefined symbol: _ZTV11AgentServer (./libagent.so)
  </code></pre>
  
  <p>My current compile command is:</p>
  
  <pre><code>g++ $(CXXFLAGS) -fPIC -shared -o libagent.so $(INCPATH) ../src/agent.cpp ../src/agentserver.cpp
  </code></pre>
  
  <p>Where $(CXXFLAGS) is -m64 -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)</p>
  
  <p>where $(DEFINES) is -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED</p>
  
  <p>where $(INCPATH) is -I/home/konrad/qtsdk-2010.05/qt/mkspecs/linux-g++-64 -I../src -I/home/konrad/qtsdk-2010.05/qt/include/QtCore -I/home/konrad/qtsdk-2010.05/qt/include/QtNetwork -I/home/konrad/qtsdk-2010.05/qt/include/QtGui -I/home/konrad/qtsdk-2010.05/qt/include -I/usr/lib/jvm/java-6-openjdk/include -I/usr/lib/jvm/java-6-openjdk/include/linux -I. -I. -I../src -I.</p>
  
  <p>I have put some time into researching this problems, but none solved this error.</p>
  
  <hr>
  
  <p>This is the header code of the agentserver.cpp: <a href="http://pastebin.com/dsdWUgSR" rel="nofollow">agentserver.h</a></p>