Roman Mashak
2006-03-30 06:22:17 UTC
Hello, All!
What's the big difference of using </if.h> and <linux/if.h> ? Consider for
instance simple code:
#include <net/if.h>
int main(void)
{
char buf[IFNAMSIZ];
struct ifreq ifr;
return 0;
}
#gcc -ansi -W -Wall ifr1.c
ifr1.c: In function `main':
ifr1.c:13: `IFNAMSIZ' undeclared (first use in this function)
ifr1.c:13: (Each undeclared identifier is reported only once
ifr1.c:13: for each function it appears in.)
ifr1.c:14: storage size of `ifr' isn't known
ifr1.c:13: warning: unused variable `buf'
ifr1.c:14: warning: unused variable `ifr'
"Storage size isn't known" means that particular structure was found
undefined in the scope, on the other hand "gcc -E .." produced quite valid
output.
Upon changing included header to <linux/if.h> compilation succeded. What's
so magical in it?
Yes, I'm using RedHat ang glibc.
Thanks in advance.
With best regards, Roman Mashak. E-mail: ***@tusur.ru
What's the big difference of using </if.h> and <linux/if.h> ? Consider for
instance simple code:
#include <net/if.h>
int main(void)
{
char buf[IFNAMSIZ];
struct ifreq ifr;
return 0;
}
#gcc -ansi -W -Wall ifr1.c
ifr1.c: In function `main':
ifr1.c:13: `IFNAMSIZ' undeclared (first use in this function)
ifr1.c:13: (Each undeclared identifier is reported only once
ifr1.c:13: for each function it appears in.)
ifr1.c:14: storage size of `ifr' isn't known
ifr1.c:13: warning: unused variable `buf'
ifr1.c:14: warning: unused variable `ifr'
"Storage size isn't known" means that particular structure was found
undefined in the scope, on the other hand "gcc -E .." produced quite valid
output.
Upon changing included header to <linux/if.h> compilation succeded. What's
so magical in it?
Yes, I'm using RedHat ang glibc.
Thanks in advance.
With best regards, Roman Mashak. E-mail: ***@tusur.ru