Linking .so Shared Object File with Relative Path in GCC (G++)

These options must be together for finding the .so files:


For example:

  • g++ -shared -o file.cpp -fPIC -Wl,-rpath,. -L.
  • g++ -shared -o file.cpp -fPIC -wl,-rpath,./libs -L./libs

The -Wl,-rpath and -L must be together, and the -l must come with colon
after to specify the exact file name.

You'll only receive email when they publish something new.

More from 19331933
All posts