Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
An #include guard prevents a header file to be compiled multiple times (this will happen if a header file is #included by multiple header files, which will cause a redeclaration error).
An #include guard looks like the code below:
#ifndef MYHEADERFILE_H |
An implementation (.cpp) file does not have an #include guard, because they do not get #included, but 'Added to Project' instead.
Always write internal #include guards [1][2][3]. Never write external #include guards [1]. Use a unique and predictable name [3].
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.