Reputation: 317
How does one know the name of the library when linking it with LDFLAGS in a Makefile?
For example:
libxml2.dylib is linked with -lxml2
libz.dylib which is actually named zlib is linked with -lz
Where are those flags specified? How does one look them up?
Upvotes: 2
Views: 1156
Reputation: 4996
By convention, you remove the preceding 'lib' from the library filename. For a library file called, 'libmyspecial_library.so', the corresponding flag is:
-lmyspecial_library
This is actually a convention with the gcc compiler. See the gcc man page for more info:
-llibrary Use the library named library when linking. The linker searches a standard list of directories for the library, which is actually a file named `liblibrary.a'. The linker then uses this file as if it had been specified precisely by name....
Upvotes: 3