Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Adding libpcap includes and library

Hi,

You need to add the library in the build setting. Click on project
properties, C/C++ build -> Settings, in the toolsetting tab, go to the
gcc C++ linker->Libraries and add pcap as libraries.
If the libraries is in the /usr/lib folder don't need to specify the
path in this window.

When you compile you should see something with -lpcap in it
g++ -L/usr/lib -lpcap -o"sNAP"  ./main.o

For more info see http://wiki.eclipse.org/CDT/User/FAQ.

Drix

On 7/29/07, Frank DiRocco <ofanged1@xxxxxxxxx> wrote:
> I have been searching for a solution all night. I have RTFM and searched
> Google numerous times, although, I can't seem to get this right. I am
> attempting to use libpcap to display network interface info. I have read
> that I may have not linked against the libraries correctly... I am just
> learning cpp so I may have done something really stupid, any help will be
> appriciated. Additionally I anyone knows of a book for cpp that focuses on
> using eclipse I would enjoy hearing about it. Thnaks in advance.
>
> $ whereis libpcap
> libpcap: /usr/lib/libpcap.a /usr/lib/libpcap.so
>
> $ aptitude search libpcap | grep "i "
> i   libpcap0.8                      - System interface for user-level packet
> cap
> i   libpcap0.8-dev                  - Development library and header files
> for l
>
> [eclipse]
> g++ -L/usr/lib -o"sNAP"  ./main.o
> ./main.o: In function `main':
> /home/ofanged1/workspace/sNAP/Debug/../main.cpp:6:
> undefined reference to `pcap_lookupdev'
> collect2: ld returned 1 exit status
> make: *** [sNAP] Error 1
>
> --
> Frank DiRocco
>
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
>
>


Back to the top