Re: question about the -I option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux