July 28, 2012

Error on including #include linux/if.h

Another WTF moment!

arao@snowmane:~/tunnel-test$ cat test.c
#include <linux/if.h>
#include <linux/if_tun.h>

int main()
{
    return 0;
}
 
arao@snowmane:~/tunnel-test$ gcc test.c
In file included from test.c:1:0:
/usr/include/linux/if.h:179:19: error: field ‘ifru_addr’ has incomplete type
/usr/include/linux/if.h:180:19: error: field ‘ifru_dstaddr’ has incomplete type
/usr/include/linux/if.h:181:19: error: field ‘ifru_broadaddr’ has incomplete type
/usr/include/linux/if.h:182:19: error: field ‘ifru_netmask’ has incomplete type
/usr/include/linux/if.h:183:20: error: field ‘ifru_hwaddr’ has incomplete type


WTF !!!! Some google searches later...

arao@snowmane:~/tunnel-test$ cat test.c
#include <sys/types.h>
#include <sys/socket.h>>
#include <linux/if.h>
#include <linux/if_tun.h>

int main()
{
    return 0;
}
arao@snowmane:~/tunnel-test$ gcc test.c
arao@snowmane:~/tunnel-test$

:)

1 comment:

Anonymous said...

Thanks. It helped ...