RAD Studio
ContentsIndex
PreviousUpNext
#include

Syntax

#include <header_name>
#include "header_name"
#include <macro_definition>

Description 

The #include directive pulls in other named files, known as include files, header files, or headers, into the source code. The syntax has three versions:

  • The first and second versions imply that no macro expansion will be attempted; in other words, header_name is never scanned for macro identifiers. header_name must be a valid file name with an extension (traditionally .h for header) and optional path name and path delimiters.
  • The third version assumes that neither < nor " appears as the first non-whitespace character following #include; further, it assumes a macro definition exists that will expand the macro identifier into a valid delimited header name with either of the <header_name> or "header_name" formats.
The preprocessor removes the #include line and conceptually replaces it with the entire text of the header file at that point in the source code. The source code itself is not changed, but the compiler "sees" the enlarged text. The placement of the #include can therefore influence the scope and duration of any identifiers in the included file. 

If you place an explicit path in the header_name, only that directory will be searched. 

The difference between the <header_name> and "header_name" formats lies in the searching algorithm employed in trying to locate the include file.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!