The
#include Directive
The
#include directive has two primary forms. The first form is used for header
files that belong to C's own library:
#include
The second form is used for all
other header files, including any that we write:
#include "filename"
The
difference between the two is a subtle one having to do with how the compiler
locates the header file. Here are the rules that most compilers follow:#include
: Search the directory (or directories) in which system
header files reside. (On UNIX systems, for example, system header files are
usually kept in the directory /usr/include.)
#include "filename":
Search the current directory, then search the directory (or directories) in
which system header files reside.
The
places to be searched for header files can usually be altered, often by a command-line
option such as -I path.
No comments:
Post a Comment