i'm trying to compile libpcap by gcc-3.3 i got this problem there is a file <netinet/in.h> which contains IPPROTO_HOPOPTS = 0 /* long constant name */ that results in /usr/include/netinet/in.h:34: error: parse error before numeric constant stripping the name by few characters resolve the problem
We need the preprocessed file? Read http://gcc.gnu.org/bugs.html.
Created attachment 4579 [details] the preprocessed file
the options given when GCC was configured/built: #!/bin/sh # This file was generated automatically by configure. Do not edit. # This directory was configured as follows: ./configure --with-gcc-version-trigger=/home/agri/cmpl/gcc-3.3/gcc/version.c --host=i686-pc-linux-gnu --prefix=/usr --enable-threads --with-cpu=i686 --disable-nls --norecursion # using "mt-frag" the complete command line that triggers the bug and output: > gcc -O2 -I. -DHAVE_CONFIG_H -c ./pcap-snoop.c In file included from pcap-snoop.c:40: /usr/include/netinet/in.h:70: error: parse error before numeric constant pcap-snoop.c: In function `pcap_read': pcap-snoop.c:88: error: dereferencing pointer to incomplete type pcap-snoop.c:90: error: invalid use of undefined type `struct snoopheader' pcap-snoop.c:96: error: dereferencing pointer to incomplete type pcap-snoop.c:97: error: dereferencing pointer to incomplete type pcap-snoop.c: In function `pcap_stats': pcap-snoop.c:110: error: storage size of `rawstats' isn't known pcap-snoop.c:113: error: dereferencing pointer to incomplete type pcap-snoop.c:113: error: dereferencing pointer to incomplete type pcap-snoop.c:113: error: dereferencing pointer to incomplete type pcap-snoop.c:113: error: dereferencing pointer to incomplete type pcap-snoop.c:113: error: dereferencing pointer to incomplete type pcap-snoop.c:113: error: dereferencing pointer to incomplete type pcap-snoop.c:114: error: `SIOCRAWSTATS' undeclared (first use in this function) pcap-snoop.c:114: error: (Each undeclared identifier is reported only once pcap-snoop.c:114: error: for each function it appears in.) pcap-snoop.c:134: error: dereferencing pointer to incomplete type pcap-snoop.c:134: error: dereferencing pointer to incomplete type pcap-snoop.c:135: error: dereferencing pointer to incomplete type pcap-snoop.c:135: error: dereferencing pointer to incomplete type pcap-snoop.c: In function `pcap_open_live': pcap-snoop.c:151: error: storage size of `sr' isn't known pcap-snoop.c:152: error: storage size of `sf' isn't known pcap-snoop.c:166: error: `PF_RAW' undeclared (first use in this function) pcap-snoop.c:166: error: `RAWPROTO_SNOOP' undeclared (first use in this function) pcap-snoop.c:174: error: `AF_RAW' undeclared (first use in this function) pcap-snoop.c:182: error: `SIOCADDSNOOP' undeclared (first use in this function) pcap-snoop.c:267: error: `SIOCSNOOPLEN' undeclared (first use in this function) pcap-snoop.c:274: error: `SIOCSNOOPING' undeclared (first use in this function)
The code is defining IPPROTO_HOPOPTS as 59 so the preprocessor is replacing IPPROTO_HOPOPTS with 59 so in the enum you get: 59 = 59, and that is an invalid for an enum. The code is wrong find out where IPPROTO_HOPOPTS is being defined and why (might have been a configuring of libpcap wrong). Closing as this is not a GCC bug.
:-) i never though that even developers doesn't know what do gcc do now... let me try again let me cat part of netinet/in.h enum { IPPROTO_IP = 0, #define IPPROTO_IP IPPROTO_IP oopps it's already has such a define.... it doesn't complain about it it complains on the line (one line before define) IPPROTO_HOPOPTS = 0 not on the line #define IPPROTO_HOPOPTS IPPROTO_HOPOPTS and if i edit that line as IPPROTO_HOPO = 0, #define IPPROTO_HOPO IPPROTO_HOPO it won't complain about at all
Not a GCC bug but a problem in a conflict in the glibc and Linux kernel headers, report it to both of them and let them deiced whos problem it is.