Development Reference Guides


Manage Libraries

Manage Libraries on Linux

During compilation, the compiler reads the
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
environment variable. Add the location of your static libraries to the
environment variable so that they are available for linking during compilation.
For example, to compile
and link it with the library
, located in the
, using the
  1. Add the directory
    from the command line with the export command:
    Alternately, add the directory to
    by addiing the export command to your startup file.
  2. Compile
    and link it with
    icpx file.cpp lib.a
To link your library during compilation without modifying the
environment variable use the
option. For example:
icpx file.cpp -L /libs lib.a
During compilation, the compiler passes object files to the linker in the following order:
  1. Object files, from files specified on the command line, in the order they are specified (left to right)
  2. Objects or libraries specified in default configuration files
  3. Default Intel and system libraries
For example, the command
icpx lib1.a file.cpp lib2.a
would have the following link order:
  1. lib1.a
  2. file.o
  3. lib2.a
  4. Objects or libraries specified in default configuration files
  5. Default Inel and system libraries
Compile with SYCL and Link Other Compilers
When you use the Intel® DPC++ Compiler and source its entire environment, then linking works correctly with other compilers if the correct path to the compiler libraries is set. This allows programs to be compiled with SYCL and then linked with other compilers (example:
). If you try to do this without sourcing the compiler environment, the linking fails with undefined references in
and other internal libraries.
To resolve this, add the following paths to
<install_dir>/compiler/latest/linux/compiler/lib/intel64 <install_dir>/compiler/latest/linux/lib <install_dir>/compiler/latest/linux/lib/x64 <install_dir>/tbb/latest/lib/intel64/gcc4.8

Manage Libraries on Windows

environment variable contains a semicolon-separated list of directories in which the Microsoft linker will search for library (
) files. The compiler does not specify library names to the linker but includes directives in the object file to specify the libraries to be linked with each object.
For more information on adding library names to the response file and the configuration file, see Using Response Files and Using Configuration Files.
To specify a library name on the command line, you must first add the library's path to the
environment variable. Then you can specify the library name on the command line. For example, to compile
and link it with the library
with the Intel® C++ Compiler,
enter the command:
icx file.cpp mylib.lib

Other Considerations

The Intel Compiler Math Libraries contain performance-optimized implementations for various Intel platforms. By default, the best implementation for the underlying hardware is selected at runtime. The library dispatch of multi-threaded code may lead to apparent data races, which may be detected by certain software analysis tools. However, as long as the threads are running on cores with the same CPUID, these data races are harmless and are not a cause for concern.

Product and Performance Information


Performance varies by use, configuration and other factors. Learn more at