Generator for Include File Guards






4.20/5 (2 votes)
Jul 19, 2001

55882

579
A little utility that generates header file guards against multiple inclusion.
Introduction
It is common practice to prevent multiple inclusion of C++ header files by using:
#if !defined(uniqueID) #define uniqueID #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER declarations #endif // uniqueID
The MFC wizard generates a GUID to produce a unique ID. For a header file not generated by the IDE, you have to do this on your own. See this article from Joseph M. Newcomer.
This little utility takes the name of the header and produces a unique include guard ready to be copied and pasted into the header file.