[Courses] C Programming For Absolute Beginners, Lesson 1: Setting Up, First Program
Kathryn Hogg
kjh at flyballdogs.com
Mon Feb 6 16:10:32 UTC 2012
On 2012-02-05 23:58, jim wrote:
> Aha (with thanks). There's the difference between
> #include < xyz.h >
> and
> #include " ../../jersey/work/include/myxyz.h "
>
> The < > uses the include path whereas
> the " " specifies some relative or absolute path
> to some file.
That's close. All that really happens is that "." is added to include
path when you use double quotes. Please note that the directory is the
directory that the file doing the #include is located in. This may be
different than the .c file you are compiling in if a header file is the
one doing the #include "file.h".
In your case, it was searching for
"./../../jersey/work/include/myxyz.h". Assuming it finds that file,
all is well and good. If it doesn't, it tries all the directories in
your include path .
> Also, the file to be included can be any text
> file, yes? Although no sense in #include-ing a file
> that doesn't follow the rules of the C language, as
> such would cause compile errors and failure.
The preprocessor just includes whatever while you give it. If it has
syntax errors, you will be notified.
--
Kathryn Hogg
http://womensfooty.com
More information about the Courses
mailing list