O'Reilly logo

Just Enough C/C++ Programming by Guy W. Lecky-Thompson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The #include Directive

The #include directive, as you might recall, indicates to the compiler that you want it to treat an external file as part of the file being compiled. The basic syntax for this directive is as follows:

#include <filename.h>

or

#include "filename.h"

Note that there is no semicolon at the end of the line, although you can make a comment after it using the // or /* comment */ markers for C commenting. The types of characters delimiting the filename are significant.

The first use indicates that you want to look for <filename.h> in the standard include directories. These are usually added in the environment of the compiler during installation and may be found in a folder on the path of the compiler set called include.

For example, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required