开发者

How to resolve error "Undefined reference to `pcap_parse'"

I am trying to use the libpcap library in a C++ program.

I have downloaded libpcap-1.0.0.tgz, untared it, and then

./configer
make
make install

I have libpcap.a and headers with me, and I have written one sample program to test it. But it is giving me compiler errors as follows:

/usr/local/lib/libpcap.a(gencode.o): In function `.L151':
gencode.c:(.text+0x7f4): undefined reference to `pcap_parse'
collect2: ld returned 1 exit status

I am compiling this program using following command:

g++ -o t开发者_高级运维est test.cpp -lpcap

Am i doing anything wrong in building libpcap and headers?


I'm pretty sure you need to pass -lpcap before test.cpp


Try installing libstdc++-4.8-dev - this worked for me when I had a similar issue.


You have to install Libpcap-devel using this command ( sudo apt-get install libpcap-dev ) if it doesn't work install flex too (sudo apt-get install bison)

good luck


Include grammar.c which gets generated after you run ./configure and make.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜