问题描述
我的构建要求我发出以下命令:
My build requires that I issue the following commands:
$ g++ sniff.cpp -o sniff -lcrafter
但是,在我的 Eclipse 构建中,编译器得到的只是:
However, in my Eclipse build, all the complier gets is:
g++ -o "sniffer_crafter" ./src/sniffer_crafter.o
收到这些命令后,它抱怨我有一个未定义的对库 Crafter 的引用.
After getting these commands it complains that I have an undefined reference to the library Crafter.
如何使用 Eclipse 解决此链接问题?我见过其他人对类似问题的回答,但他们似乎没有解决 Eclipse 的当前布局.我正在使用最新版本的 Eclipse Kepler.
How can I resolve this linking issue using Eclipse? I have seen others answers to similar questions, but they don't seem to address Eclipse's current layout. I'm using the most recent edition of Eclipse Kepler.
推荐答案
包含库:-
右键项目 -->
- 转到属性
- 然后转到 --> C/C++ Build --> 设置
在那里你会找到链接器和子类型库.
There you will find Linker and sub type Libraries.
在右侧的库搜索路径中添加库路径(您的 .so 文件所在的位置)并在库中提供库名称
Add the library path in Library Search Path on right hand side (where your .so file is located) and give the lib name in libraries
对于 libcrafter.so 路径 -->/opt/myLib/lib
for libcrafter.so path --> /opt/myLib/lib
将路径指定为/opt/myLib/lib和库名称作为工匠
give path as /opt/myLib/lib and library name as crafter
这篇关于Eclipse 中的编译器标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!