makefile 中的LDFLAGS
(2013-12-04 11:12:22)
标签:
it |
分类: Linux |
makefile 中link 动态或者静态库的方法如下:
LDFLAGS= -L<</SPAN>Directory where the library resides> -l<</SPAN>library name>
注意点:
Make sure that the -L
-l
-L
-lname
libmine.a
libmine.so
.dylib
.sl
).
Conventionally, a static library will be in a file libmine.a
.
This is convention, not mandatory, but if the name is not in
the libmine.a
-lmine
The -L./libmine
libmine
-
You have such a sub-directory containing
libmine.a
, in which case you also need to add-lmine
to the linker line (after the object files that reference the library). -
You have a file
libmine
that is a static archive, in which case you simply list it as a file ./libmine
with no-L
in front. Aga -
You have a file
libmine.a
in the current directory that you want to pick up. You can either write ./libmine.a
or -L . -lmine
and both should find the library.