Skip site navigation (1)Skip section navigation (2)
From:      "Dylan A. Loomis" <dylan@aero.org>
To:        Zhihui Zhang <zzhang@cs.binghamton.edu>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: How to include my head file?
Message-ID:  <19990608094610.A1219@rush.aero.org>
In-Reply-To: <Pine.GSO.3.96.990608103449.15332A-100000@sol.cs.binghamton.edu>; from Zhihui Zhang on Tue, Jun 08, 1999 at 07:43:40AM -0700
References:  <Pine.GSO.3.96.990608103449.15332A-100000@sol.cs.binghamton.edu>

next in thread | previous in thread | raw e-mail | index | archive | help

--T4sUOijqQbZv57TR
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable

On Tue, Jun 08, 1999 at 07:43:40AM -0700, Zhihui Zhang wrote:
>=20
> I modify the kernel a little bit.  I add a file "test.h" under the
> directory /usr/src/sys/ufs/ufs.  But when I declare
>=20
> #include <ufs/ufs/test.h>

The compiler is actually looking in its default search path which is
is actually /usr/include.

>=20
> The compiler says it can not find the file test.h.  But it does not
> complain about an existing head file, like:=20
>=20
> #include <ufs/ufs/dir.h>

If you look in /usr/include/ufs/ufs/ you'll see dir.h resides there as well.

>=20
> I have to declare the following (with complete pathname):
>=20
> #include </usr/src/sys/ufs/ufs/test.h>
>=20
> Why there is a difference between dir.h and test.h?  How to let the
> compiler start searching for head files from /usr/src?

The difference is that dir.h exists in two places, and the one being found
is the one in /usr/include/ufs/ufs so if you put your test.h there it will
be found with the:

#include <ufs/ufs/test.h>

Line otherwise, you need to specify the full path:

#include </usr/src/sys/ufs/ufs/test.h>

as you did above, or tell the compiler that it needs to include the
/usr/src/sys in its search path, done with the -I flag e.g.

gcc -I/usr/src/sys foo.c

Then it will find test.h in /usr/src/sys/ufs/ufs with the line

#include <ufs/ufs/test.h>

>=20
> Thanks for any help.
>=20
> --------------------------------------------------
> Zhihui Zhang.  Please visit http://www.freebsd.org
> --------------------------------------------------
>=20
>=20
>=20
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message

				Hope that helps -DAL-

--=20
Dylan A. Loomis
Computer Systems Research Department     The Aerospace Corporation
e-mail: dylan@aero.org                   phone: (310) 336-2449

PGP Key fingerprint =3D  55 DE BB DD 34 10 CD 20  72 79 88 FE 02 0E 21 3A
PGP 2.6.2 key available upon request

--T4sUOijqQbZv57TR
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBN11I0OzCrQVfDVWRAQGfpQP/VdoPd6s+Dcw4R6RUlzHmrR7delFKFtdD
YglzbuiHMygcp9GQgk8ndf5uOWH0+06Qv1RJXpoRYtshLklWgarPhneDLgC7Qj4c
FfUoX55JLt1EMU3my1ZELIWKq17YJ8VnQWavfStCHvtm6hPP2g3Uuxcv8ZoaExzC
LJbmI9V9ibY=
=k0lm
-----END PGP SIGNATURE-----

--T4sUOijqQbZv57TR--


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?19990608094610.A1219>