Next: , Previous: Header Files, Up: Introduction

1.10 Linking with the Library

When linking with a shared version of the QSMM library, dependencies on other libraries that may be used by the QSMM library are compiled in the file of shared library, and you do not need to specify them in a link command. (Those dependencies are defined at a package configuring phase when you execute the configure script.) An example command to link with a shared version of the library is

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

You need to specify option -L/usr/local/lib if the library is installed in directory /usr/local/lib/ and that directory is not on standard search path of your linker.

When linking with a static version of the library, in a link command you should also specify libraries the QSMM library depends on using such linker options as -lgsl, -lmpfr, -lgmp, and -lm. An example command to produce a fully statically linked executable is

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

Alternatively, you can link via command libtool, which uses file copied to the library directory when installing the package. That file describes all necessary dependencies needed to produce an executable linked against the library, which are useful in case of static linking.