Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #13146 > unrolled thread

What's wrong with linux/if.h and net/if.h?

Started byfish <wenkai1987@gmail.com>
First post2012-01-06 00:11 -0800
Last post2012-01-06 01:49 -0800
Articles 4 — 4 participants

Back to article view | Back to comp.lang.c++


Contents

  What's wrong with linux/if.h and net/if.h? fish <wenkai1987@gmail.com> - 2012-01-06 00:11 -0800
    Re: What's wrong with linux/if.h and net/if.h? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-01-06 08:53 +0000
    Re: What's wrong with linux/if.h and net/if.h? Ian Collins <ian-news@hotmail.com> - 2012-01-06 21:54 +1300
    Re: What's wrong with linux/if.h and net/if.h? Goran <goran.pusic@gmail.com> - 2012-01-06 01:49 -0800

#13146 — What's wrong with linux/if.h and net/if.h?

Fromfish <wenkai1987@gmail.com>
Date2012-01-06 00:11 -0800
SubjectWhat's wrong with linux/if.h and net/if.h?
Message-ID<65d77142-fbf4-403f-beda-fa265ec5bee2@o9g2000yqa.googlegroups.com>
In my project, I include pfring.h, but compile error: some functions
in net/if.h and linux/if.h are redefinition. I found that the pfring.h
include linux/if.h So, I test a program, my test code:

#include <linux/if.h>
#include <net/if.h>

int main(void) {
    return 0;
}
It expected compile error. So, what's wrong with linux/if.h and net/
if.h ? Can not I include them at once?

error message:
===========================
In file included from test.c:1:0:
/usr/include/linux/if.h:178:19: error: field 'ifru_addr' has
incomplete type
/usr/include/linux/if.h:179:19: error: field 'ifru_dstaddr' has
incomplete type
/usr/include/linux/if.h:180:19: error: field 'ifru_broadaddr' has
incomplete type
/usr/include/linux/if.h:181:19: error: field 'ifru_netmask' has
incomplete type
/usr/include/linux/if.h:182:20: error: field 'ifru_hwaddr' has
incomplete type
In file included from test.c:2:0:
/usr/include/net/if.h:45:5: error: expected identifier before numeric
constant
/usr/include/net/if.h:112:8: error: redefinition of 'struct ifmap'
/usr/include/linux/if.h:136:8: note: originally defined here
/usr/include/net/if.h:127:8: error: redefinition of 'struct ifreq'
/usr/include/linux/if.h:170:8: note: originally defined here
/usr/include/net/if.h:177:8: error: redefinition of 'struct ifconf'
/usr/include/linux/if.h:219:8: note: originally defined here

[toc] | [next] | [standalone]


#13147

FromJorgen Grahn <grahn+nntp@snipabacken.se>
Date2012-01-06 08:53 +0000
Message-ID<slrnjgddk7.1ls.grahn+nntp@frailea.sa.invalid>
In reply to#13146
On Fri, 2012-01-06, fish wrote:
> In my project, I include pfring.h, but compile error: some functions
> in net/if.h and linux/if.h are redefinition. I found that the pfring.h
> include linux/if.h So, I test a program, my test code:
...

Wrong group; try comp.os.linux.networking or
comp.os.linux.development.system.

/Jorgen

-- 
  // Jorgen Grahn <grahn@  Oo  o.   .     .
\X/     snipabacken.se>   O  o   .

[toc] | [prev] | [next] | [standalone]


#13148

FromIan Collins <ian-news@hotmail.com>
Date2012-01-06 21:54 +1300
Message-ID<9mnr6aFdr5U4@mid.individual.net>
In reply to#13146
On 01/ 6/12 09:11 PM, fish wrote:
> In my project, I include pfring.h, but compile error: some functions
> in net/if.h and linux/if.h are redefinition. I found that the pfring.h
> include linux/if.h So, I test a program, my test code:
>
> #include<linux/if.h>
> #include<net/if.h>

You really should ask this on a Linux programming group.

-- 
Ian Collins

[toc] | [prev] | [next] | [standalone]


#13152

FromGoran <goran.pusic@gmail.com>
Date2012-01-06 01:49 -0800
Message-ID<d468c6d1-f0c1-4c92-9d55-79ed31f0d8c3@q7g2000yqn.googlegroups.com>
In reply to#13146
On Jan 6, 9:11 am, fish <wenkai1...@gmail.com> wrote:
> In my project, I include pfring.h, but compile error: some functions
> in net/if.h and linux/if.h are redefinition. I found that the pfring.h
> include linux/if.h So, I test a program, my test code:
>
> #include <linux/if.h>
> #include <net/if.h>
>
> int main(void) {
>     return 0;}
>
> It expected compile error. So, what's wrong with linux/if.h and net/
> if.h ? Can not I include them at once?
>
> error message:
> ===========================
> In file included from test.c:1:0:
> /usr/include/linux/if.h:178:19: error: field 'ifru_addr' has
> incomplete type

Off the top of my head.. ifru_addr is sockaddr, so try including sys/
socket.h (sockaddr should be defined there) before linux/if.h

If that's your problem, then I'd say that linux/if.h is broken. You
should be able to include it anywhere and expect stuff to work.

Goran.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.c++


csiph-web