android NDK libpcap undefined reference to `pcap_parse 等错误解决

/home/jack/rjjni/hello-jni/obj/local/armeabi/libpcap.a(gencode.o): In function `pcap_compile':
/home/jack/rjjni/hello-jni/jni/libpcap/gencode.c:389: undefined reference to `pcap_parse'
/home/jack/rjjni/hello-jni/obj/local/armeabi/libpcap.a(scanner.o): In function `yylex':
/home/jack/rjjni/hello-jni/jni/libpcap/scanner.l:356: undefined reference to `pcap_lval'
/home/jack/rjjni/hello-jni/obj/local/armeabi/libpcap.a(scanner.o): In function `yylex':
/home/jack/rjjni/hello-jni/jni/<stdout>:3640: undefined reference to `pcap_lval'


NDK编译libpcap库是出现错误,

在LINUX下解决是使用libpcap-dev但是android官方的libpcap貌似没有

解决办法:

在 grammar.y 和 grammar.c文件中,注释掉以下内容:

//#ifndef YYBISON
int yyparse(void);

int
pcap_parse()
{
    return (yyparse());
}
//#endif

 

同时在scanner.c和scanner.l中注释掉以下内容:

//#define yylval pcap_lval

 

这样再试试,我是行啦

你可能感兴趣的:(linux,android,function,reference)