1

When using g++, I have been given the following commands to run:

g++ main.cpp libShared.so -Wl,-rpath, -lboost_system -lboost_filesystem

Now, libShared.so is in the same directory as my makefile, and I have been told that the -Wl and -rpath commands are used to tell my executable to look in the same directory when searching for this shared library.

My question is: What is the purpose of the commas after -Wl and -rpath?

Karnivaurus
  • 22,823
  • 57
  • 147
  • 247

1 Answers1

2

From the g++ man page,

-Wl,option

Pass option as an option to the linker. If option contains commas, it is split into multiple options at the commas. You can use this syntax to pass an argument to the option. For example, -Wl,-Map,output.map passes -Map output.map to the linker. When using the GNU linker, you can also get the same effect with -Wl,-Map=output.map.

Community
  • 1
  • 1
scohe001
  • 15,110
  • 2
  • 31
  • 51