Linking

This topic describes the options that let you control and customize the linking with tools and libraries and define the output of the ld linker. See the ld man page for more information on the linker.

Option Description
-Ldirectory Instruct the linker to search directory  for libraries.
-Qoption,tool,list Passes an argument list to another program in the compilation sequence, such as the assembler or linker.
-shared Instructs the compiler to build a Dynamic Shared Object (DSO) instead of an executable.
-shared-libcxa -shared-libcxa has the opposite effect of -static-libcxa. When it is used, the Intel-provided libcxa C++ library is linked in dynamically, allowing the user to override the static linking behavior when the -static option is used. Note: By default, all C++ standard and support libraries are linked dynamically.
-i_dynamic Specifies that all Intel-provided libraries should be linked dynamically.
-static Causes the executable to link all libraries statically, as opposed to dynamically.
When -static is not used:
  • /lib/ld-linux.so.2 is linked in
  • all other libs are linked dynamically
When -static is used:
  • /lib/ld-linux.so.2 is not linked in
  • all other libs are linked statically
-static-libcxa By default, the Intel-provided libcxa C++ library is linked in dynamically. Use -static-libcxa on the command line to link libcxa statically, while still allowing the standard libraries to be linked in by the default behavior.
-Bstatic This option is placed in the linker command line corresponding to its location on the user command line. This option is used to control the linking behavior of any library being passed in via the command line.
-Bdynamic This option is placed in the linker command line corresponding to its location on the user command line. This option is used to control the linking behavior of any library being passed in via the command line.

Suppressing Linking

Use the -c option to suppress linking. For example, entering the following command produces the object files file1.o and file2.o:

prompt>icpc -c file1.cpp file2.cpp

Note

The preceding command does not link these files to produce an executable file.