This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Linking a shared library


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 say 'mylibs/lib'.

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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]