Next: , Previous: , Up: Introduction   [Contents][Index]

1.11 Linking with the Library

The QSMM library may have dependencies on other libraries. The configure script executed at the package configuring phase defines those dependencies. For a shared version of QSMM library, the shared library file has those dependencies included in it. 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. The following example command produces a fully statically linked executable:

gcc -static example.o -lqsmm -lgsl -lm

Alternatively, you can link using the libtool program. This program will use the file 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.