使用 Cygwin 定位头文件

发布于 2024-12-23 07:52:25 字数 500 浏览 1 评论 0原文

我正在使用 cygwin 并尝试设置 Winpcap。我有以下示例目录结构:

/a/basic_dump.c

/a/pcap.h

/usr/include/pcap/pcap.h >

basic_dump.c 文件有 #include "pcap.h" (它找到了)。 /a/pcap.h 文件具有 #include

在 /a 目录中,我执行 gcc -c basic_dump.c。但是,我得到pcap/pcap.h:没有这样的文件或目录

我也尝试过使用 -I /usr/include/pcap-I /usr/include 但没有运气。

任何帮助表示赞赏。 谢谢

I'm using cygwin and trying to set up Winpcap. I have the following sample directory structure:

/a/basic_dump.c

/a/pcap.h

/usr/include/pcap/pcap.h

The basic_dump.c file has #include "pcap.h" (which it finds). The /a/pcap.h file has #include <pcap/pcap.h>.

Withing the /a directory, I execute gcc -c basic_dump.c. However, I get pcap/pcap.h: no such file or directory.

I've also tried using -I /usr/include/pcap and -I /usr/include but no luck.

Any help is appreciated.
Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

倒带 2024-12-30 07:52:25

尝试以下操作:

gcc basic_dump.c -o basic_dump -I/usr/include/pcap -I/usr/include

教程介绍了如何使用 < 编写和编译 C 程序code>libpcap 这对你来说是一个很好的参考。

Try the following:

gcc basic_dump.c -o basic_dump -I/usr/include/pcap -I/usr/include

This tutorial explains how to write and compile C programs with libpcap which can be a good reference for you.

俯瞰星空 2024-12-30 07:52:25

尝试删除 -I 和包含路径之间的空格。

Try removing the space between -I and the path to your includes.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文