Topic: netinet/ip.h:162: error: expected specifier-qualifier-list

I'm trying to compile my prog (packet tracer, code based on sniffex.c), but compiling fail in ip.h header;
think the problem in wrong includes list, or in order.

$ make
gcc -Wall -lpcap -o l4pt l4pt.c
In file included from l4pt.c:21:
/usr/include/netinet/ip.h:162: error: expected specifier-qualifier-list before 'n_long'
*** Error code 1

Stop in /usr/home/iiv/c/l4pt.

includes in l4pt.c:

#include <stdio.h>
#include <pcap.h>
#include <err.h>
#include <unistd.h>
#include <stdlib.h>
#include <limits.h>
#include <signal.h>

#include <sys/types.h>
#include <sys/socket.h>
#include <net/ethernet.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
$ uname -a
FreeBSD kflavour 7.0-STABLE FreeBSD 7.0-STABLE #0: Tue Aug 12 14:06:30 YEKST 2008 
root@:/usr/obj/usr/src/sys/KFLAVOUR  i386

Re: netinet/ip.h:162: error: expected specifier-qualifier-list

Either don't include netinet/ip.h (you probably don't need to include it), or include netinet/in_systm.h before you include netinet/ip.h.

Re: netinet/ip.h:162: error: expected specifier-qualifier-list

Maxlor wrote:

or include netinet/in_systm.h before you include netinet/ip.h.

thanks, it's helped - type n_long defined therein.

in netinet/ip.h i'm use ip structure.