我运行了一个程序(链接是 -http://www.security-freak.net/raw-sockets/sniffer_eth_ip_tcp.c http://www.security-freak.net/raw-sockets/sniffer_eth_ip_tcp.c)在我的 Fedora Core 5 中。在编译时,我收到以下错误:
[root@localhost ~]# gcc sniffer_eth_ip_tcp.c
In file included from sniffer_eth_ip_tcp.c:12: /usr/include/linux/ip.h:97: error: expected specifier-qualifier-list before ‘uint8_t’
In file included from /usr/include/linux/tcp.h:21,
from sniffer_eth_ip_tcp.c:13:
/usr/include/asm/byteorder.h:6:2: warning: #warning using private kernel header; include <endian.h> instead!
sniffer_eth_ip_tcp.c: In function ‘ParseIpHeader’:
sniffer_eth_ip_tcp.c:147: error: ‘struct iphdr’ has no member named ‘daddr’
sniffer_eth_ip_tcp.c:148: error: ‘struct iphdr’ has no member named ‘saddr’
sniffer_eth_ip_tcp.c: In function ‘ParseTcpHeader’:
sniffer_eth_ip_tcp.c:185: error: ‘struct iphdr’ has no member named ‘protocol’
sniffer_eth_ip_tcp.c:187: error: ‘struct iphdr’ has no member named ‘ihl’
但是,相应头文件中的struct iphdr 包含上述数据成员。
谁能帮忙..
出现该错误的唯一方法是您的程序引用的 iphdr 不包含这些数据成员。因此,搜索所有包含的内容,检查重复的内容等(此外,您可以通过预编译运行源代码并找出包含的所有内容,这通常会提供您的答案)
[edit]
在源代码上运行 cpp 以找出包含哪些头文件(按顺序)。如果标头在正确信息之前包含错误信息,则会出现问题。本质上,只包含编译程序所需的头文件
[/edit]
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)