title: Linking dynamic library to my project
body: <p>After reading lots of post I am really confused.
  I want to link a dynamic library to my cpp code.</p>
  
  <p>The library is  in <code>/usr/local/include/sbml</code>
  and the libsbml.so file can be found in <code>/usr/local/lib</code></p>
  
  <p>I have a makefile that looks like this</p>
  
  <pre><code>SHELL = /bin/sh
  VERSION = 5.04.02
  CC      = /usr/bin/g++
  CFLAGS  = -Wall -g -D_REENTRANT -DVERSION=\"$(VERSION)\"
  LDFLAGS = -lsbml
  
  OBJ = main.o SBML.o
  
  prog: $(OBJ)
      $(CC) $(CFLAGS) -o prog $(OBJ) $(LDFLAGS)
  
  %.o: %.c
      $(CC) $(CFLAGS) -c $&lt;
  
  .PHONY : clean
  clean :
      -rm edit $(OBJ)
  </code></pre>
  
  <p>If I run the makefile I get the following error: (undefined reference to SBMLReader::readSBMLFromFile())</p>
  
  <pre><code>g++    -c -o SBML.o SBML.cpp
  /usr/bin/g++ -Wall -g -D_REENTRANT -DVERSION=\"5.04.02\" -o prog main.o SBML.o -lsbml
  sbml.o: In Funktion `SBML::readSBML()':
  sbml.cpp:(.text+0x129): Nicht definierter Verweis auf `SBMLReader::readSBMLFromFile(std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;)'
  collect2: error: ld returned 1 exit status
  </code></pre>