[wplug] Very strange problem

Rafael E. Herrera raffo at neuronet.pitt.edu
Fri Aug 2 19:40:49 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.

> 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




More information about the wplug mailing list