Eclipse中的编译器标志 [英] Compiler flags in Eclipse

查看:132
本文介绍了Eclipse中的编译器标志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的构建需要我发出以下命令:

  $ g ++ sniff.cpp -o sniff -lcrafter $ b $但是,在我的Eclipse构建中,所有编译器获得的是:







$ b b

  g ++ -osniffer_crafter./src/sniffer_crafter.o 

获取这些命令后,我抱怨我对库Crafter有一个未定义的引用。



如何使用Eclipse解决这个链接问题?我已经看到其他人回答类似的问题,但他们似乎没有解决Eclipse的当前布局。我使用的是最新版本的Eclipse Kepler。

解决方案

包含库: -



右键单击项目 - - >


  1. 转到属性

  2. 然后goto - > C / C ++ Build - >设置

您将找到链接器和子类型库。



库路径在库搜索路径在你的.so文件所在的位置和给库中的lib名称



为libcrafter.so path - > / opt / myLib / lib



将路径指定为/ opt / myLib / lib
,库名称为crafter


My build requires that I issue the following commands:

$ g++ sniff.cpp -o sniff -lcrafter 

However, in my Eclipse build, all the complier gets is:

g++  -o "sniffer_crafter"  ./src/sniffer_crafter.o 

After getting these commands it complains that I have an undefined reference to the library Crafter.

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.

解决方案

Include libraries:-

right click on the project -->

  1. Goto Properties
  2. then goto --> C/C++ Build --> Settings

There you will find Linker and sub type Libraries.

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

for libcrafter.so path --> /opt/myLib/lib

give path as /opt/myLib/lib and library name as crafter

这篇关于Eclipse中的编译器标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆