473,386 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Compiling Error with /netinet/if_ether.h

158 100+
I am trying to compile a program that i beginning to write and I need to include if_ether.h for some Arp Headers, But I keep getting compile errors when I include the file.


Expand|Select|Wrap|Line Numbers
  1. Errors
  2.  
  3. In file included from arpme.c:27:
  4. /usr/include/netinet/if_ether.h:147: error: field `ea_hdr' has incomplete type
  5. /usr/include/netinet/if_ether.h:162: error: field `ac_if' has incomplete type
  6. /usr/include/netinet/if_ether.h:183: error: field `sin_addr' has incomplete type
  7. /usr/include/netinet/if_ether.h:184: error: field `sin_srcaddr' has incomplete type
  8.  
  9. _________________________________
  10.  
  11. //Included Files
  12.  
  13. #include <ctype.h>
  14.  #include <sys/ioctl.h>
  15.  #include <fcntl.h>
  16. // +
  17. #include <sys/param.h>
  18.  #include <sys/sysctl.h>
  19.  
  20. #include <sys/timeb.h>
  21. #include <sys/file.h>
  22. #include <sys/ioctl.h>
  23. #include <ctype.h>
  24.  
  25. #include <sys/types.h>
  26. #include <sys/time.h>
  27. #include <net/bpf.h>
  28.  
  29. #ifdef HAVE_IFADDRS_H
  30.    #include <ifaddrs.h>
  31. #endif
  32. #include <sys/socket.h>
  33. #include <net/if_dl.h>
  34. #include <net/route.h>
  35. #include <net/if_types.h>
  36. #include <arpa/inet.h>
  37.  
  38. #include <netinet/if_ether.h>
  39. #ifdef HAVE_NET_ETHERNET_H
  40.    #include <net/ethernet.h>
  41. #endif
  42.  
  43.  
  44.  
Aug 4 '08 #1
4 5884
kardon33
158 100+
Found out that if I include netinet/in.h that it gets rid of the last two errors,

#/usr/include/netinet/if_ether.h:183: error: field `sin_addr' has incomplete type
#/usr/include/netinet/if_ether.h:184: error: field `sin_srcaddr' has incomplete type

but I still have the first two.

I tried grepping both ea_hdr and ac_if but nothing comes up except for if_ether.h so I don't think im missing a include.
Aug 4 '08 #2
weaknessforcats
9,208 Expert Mod 8TB
So what does if_ether.h look like around line 147.

That is where the compiler threw in the towel. So the actual is there or sometime earlier.
Aug 4 '08 #3
kardon33
158 100+
Around 147 it looks like
Expand|Select|Wrap|Line Numbers
  1. // 146 struct    ether_arp {
  2. // 147     struct     arphdr ea_hdr;            /* fixed-size header */
  3. // 148     u_int8_t arp_sha[ETHER_ADDR_LEN];    /* sender hardware address */
  4. // 149     u_int8_t arp_spa[4];            /* sender protocol address */
  5. // 150     u_int8_t arp_tha[ETHER_ADDR_LEN];    /* target hardware address */
  6. // 151     u_int8_t arp_tpa[4];            /* target protocol address */
  7. };
  8.  

But I have found a fix, I hope this helps some one else out,

Before you include /netinet/if_ether.h you have to include... (Im not 100% you need them all but for me this works so im keeping it)
Expand|Select|Wrap|Line Numbers
  1. #include <sys/param.h>
  2. #include <sys/socket.h>
  3. #include <net/if.h>
  4. #if    !defined(ultrix) && !defined(__osf__)
  5. #include <net/if_arp.h>
  6. #endif
  7. #include <netinet/in.h>
  8. #include <netinet/if_ether.h>
  9.  
Aug 4 '08 #4
weaknessforcats
9,208 Expert Mod 8TB
It looks like struct arphdr is not known to the compiler. Where is that declared?
Aug 4 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Aaron Queenan | last post by:
When I build a C++ library to .NET using the managed C++ compiler, I get the following error message: Linking... LINK : error LNK2020: unresolved token (0A000005) _CrtDbgReport LINK : error...
0
by: Kirt Loki Dankmyer | last post by:
So, I download the latest "stable" tar for perl (5.8.7) and try to compile it on the Solaris 8 (SPARC) box that I administrate. I try all sorts of different switches, but I can't get it to compile....
10
by: Pedro Pinto | last post by:
Hello there. I've created a socket program so exchange some messages with a server. The problem is the following: it compiles well but when running it gives a segmentation error here:...
2
by: genoeffo | last post by:
Hi all, I'm trying to compile compile a little ping program with gcc -o myping myping.c I have no problems, but if I compile it with gcc -o myping -std=c99 myping.c the result is: "...
21
by: Ram Prasad | last post by:
I am trying to write a simple libspf2 plugin code for my postfix ( milter) I am getting this unhelpful error message when I try to compile gcc -g1 -Wall -I/usr/local/include/spf2 -I. -c mfunc.c...
3
by: ollii | last post by:
im creating a iterrative server and i get this error error: syntax error before numeric constant and this errors occurs near this line: int listen(sock,5); need help
2
by: ezzathakeem | last post by:
dear C/C++ programmers where i can find the library <netinet/in.h> plz help waiting ..........................
1
by: dranz3r | last post by:
I wrote this c program to send a struct from the client to a server which has the same struct initialized in it. I used gcc feature of cygwin to compile it and I got the following error. Can anyone...
0
by: shekharban | last post by:
Hi, Below is the raw socket program for sending routing header in ipv6 domain. My source address is fe80::21d:9ff:fe17:58c7 and destination address is fe80::21d:9ff:fe17:5d0e in the below...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.