[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Newbie can't get gcc to find include files
From: |
Noel Yap |
Subject: |
Re: Newbie can't get gcc to find include files |
Date: |
Mon, 8 Jul 2002 03:50:00 -0700 (PDT) |
--- Gamaliel <gamalieli@hotmail.com> wrote:
> gcc is not finding an include file that is present
> when I use Cygwin
> and a bash shell. I have written a simple hello
> world program to
> illustrate the problem.
> ===================================
> #include <stdio.h>
> #include </usr/X11R6/include/Xm/Xm.h>
>
> void main()
> {
> printf "Hello World!\n";
> }
> ===================================
>
> I compile the program as follows
>
> gcc hello.c -o hello -lXm
>
> I then get error messages such as
>
> /usr/X11R6/include/Xm/Xm.h:32: X11/Intrinsic.h: No
> such file or
> directory.
>
> Intrinsic.h is included in Xm.h as follows
>
> #include <X11/Intrinsic.h>
>
> When I look for Intrinsic.h in
> /usr/X11R6/include/Xm/X11 it is
> present.
I believe you'll need to pass in a -I flag to tell gcc
where to find X11/Intrinsic.h.
You wouldn't need to do this if the line were:
#include "X11/Intrinsic.h"
> The files are specified to be in my path in the
> .profile directory.
>
> PATH="/usr/X11R6/include/Xm/X11:$PATH"
> export PATH
Unlike Windows, PATH is used solely for executables.
Even in Windows, I think PATH isn't used for include
files.
> So why doesn't gcc know that it is present?
1. Learn the difference between #include <> and
#include "".
2. Learn about the -I flag to gcc.
HTH,
Noel
__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com