gpt4 book ai didi

cygwin - 帮助在 cygwin 上安装 libpcap

转载 作者:行者123 更新时间:2023-12-02 06:30:57 47 4
gpt4 key购买 nike

我试图在 Windows 7 上的 cygwin 下安装 libpcap 但出现此错误: $ ./配置 。 。 。 。 。 配置:错误:请参阅安装以获取更多信息

我该如何解决这个问题?我正在使用 libpcap-1.0.0,这是最新版本。

最佳答案

http://mathieu.carbou.free.fr/wiki/index.php?title=How_to_install_Winpcap_/_Libpcap_under_Cygwin

libpcap开发包可以从以下位置找到 http://www.winpcap.org/devel.htm

详细步骤如下:

Setup Winpcap

  1. Download and unzip the pack. We will use for this example WpdPack_4_0_1.zip.

  2. Copy libraries like this:

    • WpdPack\Lib\libpacket.a to cygwin\lib\
    • WpdPack\Lib\libwpcap.a to cygwin\lib\
  3. Create a folder cygwin\usr\include\pcap\

  4. Copy all headers from WpdPack\Include to cygwin\usr\include\winpcap\

  5. Be sure you have installed Winpcap libraries and that they are in your path by typing:

    which packet.dll
    which wpcap.dll

For me they are in /cygdrive/c/WINDOWS/system32/

Building example using Cygwin

Open a cygwin prompt to WpdPack\Examples-pcap\basic_dump\ and execute:

basic_dump:

CFLAGS="-g -Wall -mno-cygwin -I /usr/include/pcap"
LIBS="-lwpcap"
PROG="basic_dump"
gcc $CFLAGS -c $PROG.c
gcc $CFLAGS -o $PROG.exe $PROG.o $LIBS
./$PROG.exe

basic_dump_ex:

CFLAGS="-g -Wall -mno-cygwin -I /usr/include/pcap"
LIBS="-lwpcap"
PROG="basic_dump_ex"
gcc $CFLAGS -c $PROG.c
gcc $CFLAGS -o $PROG.exe $PROG.o $LIBS
./$PROG.exe

iflist:

CFLAGS="-g -Wall -mno-cygwin -I /usr/include/pcap"
LIBS="-lwpcap"
PROG="iflist"
gcc $CFLAGS -c $PROG.c
gcc $CFLAGS -o $PROG.exe $PROG.o $LIBS
./$PROG.exe

pcap_filter (and others):

I think you can catch the pattern ;) Only replace PROG=... by the program name and it should compile.

UDPdump:

CFLAGS="-g -Wall -mno-cygwin -I /usr/include/pcap"
LIBS="-lwpcap -lwsock32"
PROG="UDPdump"
gcc $CFLAGS -c $PROG.c
gcc $CFLAGS -o $PROG.exe $PROG.o $LIBS
./$PROG.exe

You can test by doing a Time Synchronization with pool.ntp.org for example.

关于cygwin - 帮助在 cygwin 上安装 libpcap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2396251/

47 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com