Passing Linker Options with Multiple Arguments using -Xlinker,-Wl, or -Qoption,link

When using the compiler driver (icc/icpc/ifort) of Intel® C++ Compiler or Intel Fortran Compiler for Linux to link together object files, you may have a need to pass a linker option directly to "ld" that contains multiple parts, such as "-rpath <dir>".  There are several ways to do this:

Method # 1:

-Xlinker -rpath -Xlinker <dir>


Method # 2:

-Wl,-rpath,<dir>


Method # 3:

-Qoption,link,-rpath,<dir>
For more complete information about compiler optimizations, see our Optimization Notice.