[Courses] C Programming For Absolute Beginners, Lesson 1: Setting Up, First Program
Kathryn Hogg
kjh at flyballdogs.com
Mon Feb 6 02:26:46 UTC 2012
On 2012-02-05 18:45, Jacinta Richardson wrote:
> On 06/02/12 10:49, jim wrote:
>> Note that the #include preprocessor directive seems to take
>> <stdio.h>
>> as an argument.
>> The< > angle bracket characters have a special meaning:
>> /usr/include/
>>
>
> The angle brackets refer to the system directories, which might not
> always be /usr/include but could even be /opt/usr/include etc.
That's not quite correct. When you have a #include file surrounded by
angle brackets, it indicates to look for the file according to the
include path. The compiler typically has a built in include path but
you can extended via command line arguments or environment variables:
gcc -I/usr/local/include will add /usr/local/include to the front of
the include path.
When you do a #include with double quotes (#include "file.h") that
means to search the same directory as the file which is doing the
#include.
For example, if /home/kathryn/src/foo.c does
#include "foo.h"
then the compiler will search in /home/kathryn/src for foo.h and if it
doesn't find it, it will search the include path as normal.
--
Kathryn Hogg
http://womensfooty.com
More information about the Courses
mailing list