1.11 Linking with the Library

The QSMM library may have dependencies on other libraries. The configure script executed at the package configuring phase defined the dependencies. For a shared version of QSMM library, the shared library file embeds references to the dependencies, so you do not need to specify them in a link command:

gcc example.o -L/usr/local/lib -lqsmm

(If the library resides in the directory /usr/local/lib/, and that directory is not on the standard linker search path, use the option -L/usr/local/lib.)

To link with a static version of QSMM library, you need to specify libraries it depends on in a link command. For this, use linker options -l, such as -lgsl and -lm, for example:

gcc example.o -lqsmm -lgsl -lm

Alternatively, you can link using the libtool program. It uses the file libqsmm.la copied to the library directory when installing the package. That file describes all dependencies required to produce an executable linked against the QSMM library. The libtool program simplifies static linking.