关于libpcap的使用问题
小弟刚刚接触Linux下的C++编程,现遇到问题如下,望高手指点:
我使用的是Fedora Core 5,安装了gcc 4.1.2和libpcap 0.9.5
测试程序
#include <stdio.h>
int main()
{
printf("Hello Linux\n");
return(0);
}
能够成功编译运行,但是当我想用libpcap时却不行,程序如下:
#include <stdio.h>
#include <pcap.h>
int main()
{
char *dev,errbuf[100];
dev=pcap_lookupdev(errbuf);
printf("Device:%s\n",dev);
return(0);
}
我输入命令gcc -lpcap -o tlibpcap tlibpcap.c,
报错:/tmp/ccwaZYRh.o: In function `main':tlibpcap.c:(.text+0x1b):对‘pcap_lookupdev’ 未定义的引用
collect2: ld 返回 1
我libpcap的安装方法如下:
解压后,输入./configure,然后make install
望高手指点,不生感激!!