next up previous
Next: Debugging (ddd) Up: Compiled Programming Languages Previous: Fortran (compiling and using

Linking

Linking is the process of bringing in the necessary libraries that are used in your code. One common problem is that the order of linking in multiple libraries can matter. I suspect that the linking should be ordered from the libraries that rely on other libraries to those that don't. For example, atlas is a library relied on by others in the following syntax but GMRFLib is not.
gcc file.c -I/usr/local/include -L/usr/local/lib -L/usr/lib64 -lg2c -lGMRFLib -llapack -lgsl -lf77blas -lcblas -latlas -lz

Note that the executable ld does the linking; the compiler calls ld automatically.

Last modified 12/28/07.



Chris Paciorek 2012-01-21