2014-02-21 217 views
0

如何正确链接静态库到Netbeans项目中?Netbeans:将静态库链接到项目

我试图建立在FreeBSD我的应用程序 - 我得到了u和我的媒体库的.h文件(该库是魔鬼图形库BTW)

我已经加入了包括目录在图书馆:

File => Project Properties => Build => C++ Compiler => General => Include Directories

然后,根据File => Project Properties => Build => Linkers => Libraries加入我的图书馆作为一个文件:../../../source/devil/libIL.a

然而,当我编译它,我得到以下错误:

No rule to make target ../../../source/devil/libIL.a

(我自己也尝试在库路径乞讨的接头库添加-static标志。

+0

你尝试添加一个额外的lib'dir'(不仅是LIB本身)找到图书馆@'属性 - >建设 - > Linker'?其他镜头,尝试在链接器添加选项字段中添加'-lIL'。 –

+0

是的,我也尝试添加库目录路径。关于Linker附加选项中的'-lIL'选项,我得到以下错误:'/ usr/local/bin/ld:找不到-lIL'。 – Lucas

+0

对不起,我的意思是两个选项,所以'-lLD'应该在lib目录之后的'libIL.a'看起来应该是精确的。 –

回答

0

在Ubuntu,则params间接发送到装载机必须-Wl,前面,作为LD的手册(man ld)中指出:

Note---if the linker is being invoked indirectly, via a compiler driver (e.g. gcc) then all the linker command line options should be prefixed by -Wl, (or whatever is appropriate for the particular compiler driver) like this: gcc -Wl,--start-group foo.o bar.o -Wl,--end-group

的NetBeans使用在“添加选项...”按钮库菜单(项目属性>链接>库),这样做:

Screenshot of Netbeans libraries menu

在以前的形象,我用-Wl,-static所有以前的库静态链接。

干杯,

相关问题