你好,我有一个关于libpcap的问题 [英] hello i have a question about libpcap SOLVED

查看:90
本文介绍了你好,我有一个关于libpcap的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我想安装libpcap并遵循以下方法:
./configure
制作
进行安装

我已经用一个程序对其进行了测试,那么代码是:

hello, I want to install the libpcap and follow this ways:
./configure
make
make install

and I have used a program to test it, then the code is:

#include <stdio.h>
#include <stdlib.h>
#include <pcap.h>

int main( int argc, char** argv )
{
        char *dev, errbuf[PCAP_ERRBUF_SIZE];
        dev = pcap_lookupdev( errbuf );
        if ( dev == NULL )
        {
                fprintf( stderr, "couldn't find default device: %s\n", errbuf );
                return ( 2 );
        }
        printf( "Device: %s\n", dev );
        return ( 0 );
}



当我用gcc编译时,"gcc -o test24 -g test24.c -lpcap"
它将显示错误:



when I compile it by gcc, "gcc -o test24 -g test24.c -lpcap"
it will print the error :

/usr/local/lib/libpcap.so: undefined reference to `pcap_parse'
collect2: ld returned 1 exit status



请告诉我为什么?谢谢



please tell me why? thank you

推荐答案

我已经安装了libpcap-dev并解决了这个问题.
i have install libpcap-dev and fix this problem.


这篇关于你好,我有一个关于libpcap的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆