Compiler flags in Eclipse(Eclipse 中的编译器标志)
问题描述
我的构建要求我发出以下命令:
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 中的编译器标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Eclipse 中的编译器标志
基础教程推荐
- 如何在 Spring @Value 注解中正确指定默认值? 2022-01-01
- Java Swing计时器未清除 2022-01-01
- 多个组件的复杂布局 2022-01-01
- 不推荐使用 Api 注释的描述 2022-01-01
- 验证是否调用了所有 getter 方法 2022-01-01
- 在 Java 中创建日期的正确方法是什么? 2022-01-01
- 大摇大摆的枚举 2022-01-01
- 如何在 JFrame 中覆盖 windowsClosing 事件 2022-01-01
- Java 实例变量在两个语句中声明和初始化 2022-01-01
- 从 python 访问 JVM 2022-01-01
