[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
CInclude
There are two different header file #includes:
The first #include means that the header is a standard header file. The second #include means that the file is local, i.e. in the same directory as the program. If the local #include fails, the standard header file directory is checked for this header file.
Never #include unnecessary header files. Never #include a header when a ?forward declaration will suffice [3].
Forgetting to add an implementation file to you project results in a ?linking error.
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
CInclude
(C) #include
A ?preprocessor statement to add a header file (.h or .hpp) or other files to your program.There are two different header file #includes:
- include <stdio.h> // 1: Standard header file
- include "MyHeader.h" // 2: Local
The first #include means that the header is a standard header file. The second #include means that the file is local, i.e. in the same directory as the program. If the local #include fails, the standard header file directory is checked for this header file.
Never #include unnecessary header files. Never #include a header when a ?forward declaration will suffice [3].
Implementation (.c) files
These normally are not #included. Instead, these are added to your project. For example, in C++ Builder, select 'Project | Add to Project'.Forgetting to add an implementation file to you project results in a ?linking error.
'#include' links
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
