- 论坛徽章:
- 0
|
初学Linux编程,请大家多指教.
编程环境是redhat Linux9
我要做的是对数据链路层帧的处理,用到函数库lib_pcap,下面是我的操作步骤
1:从www.tcpdump.org/weekly/下载了最新的lib_pcap包:libpcap-2005.05.23.tar.gz
2:./configure接着make最后make install,
我觉得应该就装好了吧(是不是应该在某个特定路经安装啊?)
3:然后vi了一个资料上的简单程序,如下:
#include<stdio.h>;
#include<pcap.h>;
int main()
{
char *dev,errbuf[100];
dev=pcap_lookupdev(errbuf);
printf("Device:%s\n",dev);
return(0);
}
虽然对errbuf的用法还是一知半解,但我觉得这个程序还是能编译过吧
运行成功应该显示Device:eth0吧(我的单网卡)?
4:然后编译:gcc device.c 出现下面的提示
/tmp/cclnPVKm.o(.text+0x1e):In function 'main':
:undefined reference to 'pcap_lookupdev'
collect2:ld returned 1 exit status
问题有两个:
(1)为什么我安装了libpcap还是说没有定义pcap_lookupdev呢?
(2)/tmp/cclnPVKm.o(.text+0x1e)是什么意思呢?
谢谢 |
|