lipcap问题
我已经在redhat9成功安装了libpcap,其中pcap.h在目录/usr/local/include下,libpcap.a在目录/usr/local/lib下,但我编译一个C++文件时出错。
g++ -c -o testMain.o testMain.cpp (成功编译)
g++ -g -o ../bin/testpro -I/usr/local/include -L/usr/local/lib -lpcap testMain.o (编译出错)
提示:undefined reference to `pcap_lib_version'
testMain.cpp代码如下:
#include <stdio.h>
#include "pcap.h"
int main(int argc, char* argv[])
{
printf("Hello\n");
char *dev;
char errbuf[PCAP_ERRBUF_SIZE];
printf("%s\n", pcap_lib_version());
}
请高手指教,多谢!