From owner-freebsd-questions Tue Jun 8 9:46:35 1999 Delivered-To: freebsd-questions@freebsd.org Received: from aero.org (aero.org [130.221.16.2]) by hub.freebsd.org (Postfix) with ESMTP id 2021C14EAF for ; Tue, 8 Jun 1999 09:46:30 -0700 (PDT) (envelope-from dylan@rush.aero.org) Received: from rush.aero.org ([130.221.201.83]) by aero.org with ESMTP id <111120-3>; Tue, 8 Jun 1999 09:46:15 -0700 Received: (from dylan@localhost) by rush.aero.org (8.9.3/8.9.3) id JAA04414; Tue, 8 Jun 1999 09:46:11 -0700 (PDT) Date: Tue, 8 Jun 1999 09:46:10 -0700 From: "Dylan A. Loomis" To: Zhihui Zhang Cc: freebsd-questions@freebsd.org Subject: Re: How to include my head file? Message-ID: <19990608094610.A1219@rush.aero.org> References: Mime-Version: 1.0 Content-Type: multipart/signed; boundary=T4sUOijqQbZv57TR; micalg=pgp-md5; protocol="application/pgp-signature" X-Mailer: Mutt 0.95.5i In-Reply-To: ; from Zhihui Zhang on Tue, Jun 08, 1999 at 07:43:40AM -0700 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG --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 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 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 >=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 Line otherwise, you need to specify the full path: #include 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 >=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