Compiling C++ or C software to use libSBML is usually a matter of
supplying certain options during compilation and linking. Let DIR stand for the directory used during the libSBML configuration step as the value
of the --prefix=
DIRconfigure
to configure libSBML) or
CMAKE_INSTALL_PREFIX
(if you used CMake). There are two main sets of settings
on Unix-like systems such as Linux:
-IDIR/include
-I
/usr/local
, then when compiling your software to use libSBML,
you will also need to add the flag
-I/usr/local/include
-LDIR/lib -lsbml
-lstdc++ -lm
-L
If you have the pkg-config
PKG_CONFIG_PATH
environment variable includes the path to
the directory DIR/lib/pkgconfig
(which is the
directory where the file libsbml.pc
will be installed by
libSBML's make install
step). Then, you can run
pkg-config
--cflags
--libs
g++ `pkg-config --cflags --libs libsbml` myprogram.cpp
Note the use of the backward quote in the shell command above; it
has the effect of running the command
and substituting in place the flags returned by
the command.