Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Jan 2001 20:25:38 -0500 (EST)
From:      Matthew Emmerton <matt@gsicomp.on.ca>
To:        "Geoffrey Crompton (RMIT Guest)" <ghcrompton@gecko.eric.net.au>
Cc:        FreeBSD-Questions <freebsd-questions@FreeBSD.ORG>
Subject:   Re: programming in freebsd related questions
Message-ID:  <Pine.BSF.4.21.0101092020020.53322-100000@xena.gsicomp.on.ca>
In-Reply-To: <20010110121911.A29635@gecko.eric.net.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 10 Jan 2001, Geoffrey Crompton (RMIT Guest) wrote:

>   When I #include things like sys/socket.h and netinet/in.h, I get heaps
> of compiler errors, unless I do a #include <sys/types.h> before I #include
> the others. Why is that?

Because that's the way it is.  <sys/types.h> defines many things that are
used by other header files, such as <sys/socket.h> and <netinet/in.h>, so
you have to include it first, as you've found out.  Depending on your
program, you may need to include <sys/param.h> _instead of_
<sys/types.h>. (You can't include both.)

>   Also, I've noticed multiple copies of socket.h, sitting in /usr/src/sys,
> and /usr/include. I think that /usr/src is where the kernel all get's built
> from. Does the make build/installworld process copy all the header
> files that a user application might want over to the /usr/include area?

Yes.

> If I'm hunting through header files for definitions, which ones should I use?

Since it's possible for the headers in /usr/src to be a different
version than the ones in /usr/include, you want to use the ones in
/usr/include.

--
Matt Emmerton
GSI Computer Services



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0101092020020.53322-100000>