Managing Libraries

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.

Modifying LIBRARY_PATH

If you want to add a directory, /libs for example, to the LIBRARY_PATH, you can do either of the following:

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:


  1. the object file

  2. any objects or libraries specified on the command line, in a response file, or in a configuration file

  3. the Intel® Math Library, libimf.a


Submit feedback on this help topic

Copyright © 1996-2010, Intel Corporation. All rights reserved.