Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - invalid application of 'sizeof' to incomplete type 'struct ifreq': (4 Items)
   
invalid application of 'sizeof' to incomplete type 'struct ifreq'  
I am using following structure, it is defined in net/if.h.

struct ifreq        ifr;
ifr.ifr_flags = ifr.ifr_flags | IFF_PROMISC;

When I compile my application following errors displayed,

 error: storage size of 'ifr' isn't known
 error: invalid application of 'sizeof' to incomplete type 'struct ifreq'
error: 'IFF_PROMISC' undeclared (first use in this function)
 error: invalid application of 'sizeof' to incomplete type 'struct ifreq'
 error: invalid application of 'sizeof' to incomplete type 'struct ifreq'
 error: invalid application of 'sizeof' to incomplete type 'struct ifreq'

And also I would like to  get interface hw address, somebody suggested to use getifaddrs(), freeifaddrs() because 
SIOCGIFHWADDR is not supported in QNX, Can anybody give me the sample code for the same.

Thanks,
Vinod.
Re: invalid application of 'sizeof' to incomplete type 'struct ifreq'  
On Tue, Jul 21, 2009 at 05:58:27AM -0400, vinod nagula wrote:
> I am using following structure, it is defined in net/if.h.
> 
> struct ifreq        ifr;
> ifr.ifr_flags = ifr.ifr_flags | IFF_PROMISC;
> 
> When I compile my application following errors displayed,
> 
>  error: storage size of 'ifr' isn't known
>  error: invalid application of 'sizeof' to incomplete type 'struct ifreq'
> error: 'IFF_PROMISC' undeclared (first use in this function)
>  error: invalid application of 'sizeof' to incomplete type 'struct ifreq'
>  error: invalid application of 'sizeof' to incomplete type 'struct ifreq'
>  error: invalid application of 'sizeof' to incomplete type 'struct ifreq'

struct ifreq is declared in <net/if.h>

> 
> And also I would like to  get interface hw address, somebody suggested to use getifaddrs(), freeifaddrs() because 
SIOCGIFHWADDR is not supported in QNX, Can anybody give me the sample code for the same.

Check out the usage in ifconfig's af_link.c

http://community.qnx.com/integration/viewvc/viewvc.cgi/trunk/utils/i/ifconfig/af_link.c?root=core_networking&system=exsy1001&view=log

> 
> Thanks,
> Vinod.
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post34157
> 
Re: invalid application of 'sizeof' to incomplete type 'struct ifreq'  
I Included <net/if.h> file, still the error exists,

Do I need to include any more .h files.

--vinod
Re: invalid application of 'sizeof' to incomplete type 'struct ifreq'  
On Thu, Jul 23, 2009 at 12:53:11PM -0400, vinod nagula wrote:
> I Included <net/if.h> file, still the error exists,
> 
> Do I need to include any more .h files.
> 

Can you post a test case?
Thanks,

-seanb