On OSX 10.14.5, I've installed libsbml-5.18.0-libxml2-macosx-mojave.dmg from
https://sourceforge.net/projects/sbml/files/libsbml/5.18.0/stable/Mac%20OS%20X/
and I'm using:
$ g++-9 --version
g++-9 (Homebrew GCC 9.1.0) 9.1.0
I would like to compile my code using the "libsbml" namespace, e.g.:
#include <iostream>
#include <sbml/SBMLTypes.h>
using namespace std;
int main (int argc, char* argv[])
{
libsbml::SBMLDocument* document = libsbml::readSBML(argv[1]);
cout << " error(s): " << document->getNumErrors() << endl;
}
However, I get:
$ g++-9 -DLIBSBML_USE_CPP_NAMESPACE -I/usr/local/include -std=c++11 -L/usr/local/lib -lsbml sbml_test.cpp
Undefined symbols for architecture x86_64:
"libsbml::SBMLDocument::getNumErrors() const", referenced from:
_main in cctircnZ.o
ld: symbol(s) not found for architecture x86_64
FYI:
$ ls -l /usr/local/lib/libsbml*
-rw-r--r-- 1 heiland staff 17352504 Apr 15 10:54 /usr/local/lib/libsbml-static.a
-rwxr-xr-x 1 heiland staff 7763352 Apr 15 10:54 /usr/local/lib/libsbml.5.18.0.dylib*
lrwxr-xr-x 1 heiland staff 20 Jun 23 20:03 /usr/local/lib/libsbml.5.dylib@ -> libsbml.5.18.0.dylib
lrwxr-xr-x 1 heiland staff 15 Jun 23 20:03 /usr/local/lib/libsbml.dylib@ -> libsbml.5.dylib
$ file /usr/local/lib/libsbml.5.18.0.dylib
/usr/local/lib/libsbml.5.18.0.dylib: Mach-O 64-bit dynamically linked shared library x86_64
------------------
If I remove the two "libsbml::" namespace prefixes on the first line (and remove the -D compile flag), it compiles/runs as expected:
$ g++-9 -I/usr/local/include -std=c++11 -L/usr/local/lib -lsbml sbml_test_no_ns.cpp
Can someone explain what I'm doing wrong? I've done a verbose compile on the former, but don't see anything obvious.
thanks, Randy