This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: question about the -I option
- From: Dan Hipschman <dsh at linux dot ucla dot edu>
- To: maser rati <maseriyer at yahoo dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Fri, 26 Jan 2007 20:33:00 -0800
- Subject: Re: question about the -I option
- References: <418716.40755.qm@web37706.mail.mud.yahoo.com>
- Reply-to: dsh at linux dot ucla dot edu
On Fri, Jan 26, 2007 at 06:33:34PM -0800, maser rati wrote:
> I have this directory structure:
>
> test
> / \
> / \
> hello.c include
> \
> hello.h
>
> hello.c contains #include <include/hello.h>
> if I would need to compile hello.c into an executable,
> does this sound right ?
>
> [root@localhost test]# gcc -I ./include/ hello.c
>
> I'm getting an error:
> hello.c:2:27: error: include/hello.h: No such file or
> directory
Either use ``#include <include/hello.h>'' with ``gcc -I . hello.c'', or
``#include <hello.h>'' with ``gcc -I include hello.c'', or (what you
probably want) use double quotes (") instead of angle brackets around
the file name.
In your example, the compiler is looking for ./include/include/hello.h,
and it's also looking for include/hello.h in the system directories.
You might want to follow this link if you're new to C:
http://c-faq.com/cpp/inclkinds.html