Compiler flags in Eclipse

不想你离开。 提交于 2019-12-20 06:37:03

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/19502795/compiler-flags-in-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!