[wplug] Very strange problem

Hagbard Celine hceline at softhome.net
Sat Aug 3 16:02:59 EDT 2002


> 
> Hagbard Celine wrote:
> > Wow, that was fast :o)
> > 
> > If the path is `/usr/include/netinet/ip.h', and I do a `#include <netinet/ip.h>'
> > to get at it (i.e. the standard stuff), the missing defines I know about are
> 
> The path is just '/usr/include'. If you use:
> 
> #include <netinet/ip.h>
> 
> the C pre-processor will try to find the file 
> `/usr/include/netinet/ip.h'. Then,
> 
> #include <netinet/ip.h>
> #include <ip.h>
> 
> could be two different files, so it's up to you to determine what and 
> how you need to include.
> 
Seems there's another condition...

I had a `netinet' directory at the same level as traceroute.c.  It contained
some headers that came along with traceroute-4.4BSD, including `ip.h'.  On a
whim, I named it out of the way, whereupon, my errors changed.  From this, I
conclude that the C preprossesor first tries to include `./netinet/ip.h'!

I'm not sure why this is, given the `#include "foo.h"' form...

I'm still using gcc-2.95.3, in case you are wondering.

Hagbard

> > What baffles me is that if I do
> > `cp -a /usr/include/netinet/ip.h /usr/include/netinet/ipA.h' and include it
> > with `#include <netinet/ipA.h>', or if I do
> > `cp -a /usr/include/netinet/ip.h /usr/src/netkit-fnord-0.02/src/ip.h' and
> > include it with `#include "ip.h"' (traceroute.c lives on the same source tree
> > branch as the copy of ip.h), everything is fine...
> 
> You are probably breaking your system. Compare the files 
> /usr/include/netinet/ip.h and /usr/include/netinet/ipA.h, they are 
> probably different.
> 
> An `#include "ip.h"' looks for the file in the same directory where you 
> are compiling.
> 
> You should get acquainted with the man pages, they usually specify what 
> header files you need to include to use some system call or function.
> 
> You should also read the man pages for the gcc compiler and study the 
> use of the '-I' option and what include paths are. Use the '-v' option 
> to see what the default path is for your installation.
> -- 
>       Rafael
> 
> _______________________________________________
> wplug mailing list
> wplug at wplug.org
> http://www.wplug.org/mailman/listinfo/wplug
> 




More information about the wplug mailing list