During compilation, the compiler reads the LIBRARY_PATH environment variable for static libraries it needs to link when building the executable. At runtime, the executable will link against dynamic libraries referenced in the LD_LIBRARY_PATH environment variable.
If you want to add a directory, /libs for example, to the LIBRARY_PATH, you can do either of the following:
command line: prompt> export LIBRARY_PATH=/libs:$LIBRARY_PATH
startup file: export LIBRARY_PATH=/libs:$LIBRARY_PATH
To compile file.cpp and link it with the library mylib.a, enter the following command:
icpc file.cpp mylib.a
The compiler passes file names to the linker in the following order:
the object file
any objects or libraries specified on the command line, in a response file, or in a configuration file
the Intel® Math Library, libimf.a
Copyright © 1996-2010, Intel Corporation. All rights reserved.