简体   繁体   中英

Compiler flags in Eclipse

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM