Click here to Skip to main content
11,811,971 members (58,905 online)
Click here to Skip to main content

Generator for Include File Guards

, 18 Jul 2001 46.6K 473 18
Rate this:
Please Sign up or sign in to vote.
A little utility that generates header file guards against multiple inclusion.

Sample Image - IncludeGuard.jpg


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


#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.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Oliver Anhuth
Web Developer
Germany Germany
No Biography provided

You may also be interested in...

Comments and Discussions

General#pragma once Pin
Anonymous22-Jul-01 22:53
memberAnonymous22-Jul-01 22:53 
GeneralRe: #pragma once Pin
Anonymous23-Jul-01 1:56
memberAnonymous23-Jul-01 1:56 
Yes --- but only on later versions of C++ and it is not portable Smile | :)

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.151002.1 | Last Updated 19 Jul 2001
Article Copyright 2001 by Oliver Anhuth
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid