0

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.

user207421
  • 305,947
  • 44
  • 307
  • 483
amoeba
  • 95
  • 4
  • 17

1 Answers1

3

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

  • Thanks, I wasn't able to locate a .so file for my particular library, but adding its name in Properties -> C/C++ Build -> Settings -> GCC C++ Linker -> Libraries (adding the library in this field) did the trick. – amoeba Oct 21 '13 at 21:15