#include directive physically includes the contents of a specified file into the current file.
Syntax:
#include "filename"
or
#incude <filename>
When used in its first form, the referenced file is searched in the same folder as the current file. When used in the second form, a file is searched in a list of standard include folders, which you can manage on Structure Viewer Settings Page.
For example, let us have following two files:
File1.h:
struct A
{
// …
};
And File2.h:
#include "File1.h"
struct B
{
A a;
};
If there was no #include directive in File2.h, you would not be able to add this file to a Structure Library, as it uses an undefined type A. But preprocessor, which runs on the file before it is compiled, transforms the file into the following:
struct A
{
// …
};
struct B
{
A a;
};
That is, it physically inserts the contents of File1.h into File2.h, thus, making File2.h compilable. See also the #pragma once directive.
Both syntax forms, form 1 and form 2 allow you to specify absolute or relative paths, for example:
#include "c:\Projects\definitions.h" // will use an absolute path
#include "..\inc\definitions.h" // includes "definitions.h" file, located in "inc" sibling
#include <lib\definitions.h> // includes "definitions.h" file, located in "lib" subdirectory
// of one of standard include paths.