Linking a shared library
Fri Jun 1 22:37:00 GMT 2018
An executable I am creating needs to link and run with a shared library
called, let's say, 'libmyshare.so' in a relative directory called, let's
Does using the -L option while compiling the source files to object
files add the relative directory 'mylibs/lib' to the library search path
for shared libraries when linking ?
Do I specify the shared library to the linker as '-lmyshare' when
linking or do I rather specify the shared library simply as
'libmyshare.so' when linking ?
I have tried using '-Lmylibs/lib' when compiling and '-lmyshare' when
linking but the linker fails with the message:
/usr/bin/ld: cannot find -lmyshare
so I am doing something wrong and do not know what it is.
More information about the Gcc-help