#include [C++ Reference]
Keywords: preprocessor,include
Date: 2008-10-14T15:42:05-0700

[[#include]]
C++ Reference
Translations of this page?:

- en
- br-pt
- cn
- fr
- it
- jp
- pl
- ru
- tr

## #include

Syntax:

        #include <filename>
        #include "filename"

This command slurps in a file and inserts it at the current location. The main difference between the syntax of the two items is that if filename is enclosed in angled brackets, then the compiler searches for it somehow. If it is enclosed in quotes, then the compiler doesn't search very hard for the file.

While the behavior of these two searches is up to the compiler, usually the angled brackets means to search through the standard library directories, while the quotes indicate a search in the current directory. The spiffy new C++ #include commands don't need to map directly to filenames, at least not for the standard libraries. That's why you can get away with

         #include <iostream>

…and not have the compiler choke on you.

Edit this page • Old revisions
• • • Login • Index • Recent changes • RSS • cc •