Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Oct 2002 16:43:35 -0700
From:      Adam Weinberger <adam@vectors.cx>
To:        Wayne Lubin <wayneclubin@yahoo.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: adding a path to gcc to find #include <something.h> type includes
Message-ID:  <20021005234335.GI45363@vectors.cx>
In-Reply-To: <20021005230930.50079.qmail@web14701.mail.yahoo.com>
References:  <20021005225724.GF45363@vectors.cx> <20021005230930.50079.qmail@web14701.mail.yahoo.com>

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

i hope this email helps you out, and gets you on the way towards feeling
as comfortable as you please around the compiler. you have the right
idea all the way across; you're just not implementing it correctly.

>> (10.05.2002 @ 1609 PST): Wayne Lubin said, in 2.9K: <<
> #include <BuildDefines.h>
> #include <PalmOS.h>

k. this tells you that the compiler is going to want to look for the
file PalmOS.h *in one of the directories in the path*. so, if you don't
see PalmOS.h in /usr/include, you have to tell it where to find the
file. you have to tell the compiler "look for PalmOS.h relative to _____
directory."

for reference, if the line were:
#include <palm/PalmOS.h>
then your question would be "in what directory would i find
palm/PalmOS.h?"

make sense?

> I get the error mesagaes
> 
> Main.c:13: BuildDefines.h: No such file or directory
> Main.c:17: PalmOS.h: No such file or directory

right. the compiler says "i'm looking in /usr/include and
/usr/local/palmdev for PalmOS.h, but i can't find /usr/include/PalmOS.h
or /usr/local/palmdev/PalmOS.h."

> In other words it is not finding the files. But these
> files are in 
> 
> /usr/local/palmdev/sdk-3.5/include

ok. there you go. you need to tell the compiler "look for PalmOS.h in
that directory." the syntax is with the -I switch, as you correctly
identified.

cc -I/usr/local/palmdev/sdk-3.5/include Main.c

that's your magic command line.

> In fact, PalmOS.h and BuildDefines.h include more
> files that are in
> /usr/local/palmdev/sdk-3.5/include/Core/

ok. if the files are #included as <Core/whatever.h> then you're fine.
the compiler will say, "can i find the file Core/whatever.h in
/usr/local/palmdev/sdk-3.5/include?"

> Seems like there has to be a way to add a search path
> to gcc to look for included files that are of the type
> #include <thefile.h>.  It would be a pain if I had to
> manually put all the needed files into /usr/include.

HTH.

-Adam


--
"Oh good, my dog found the chainsaw."
        -Lilo, "Lilo & Stitch"
Adam Weinberger
adam@vectors.cx
http://vectors.cx


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?20021005234335.GI45363>