Click here to Skip to main content
15,880,905 members
Articles / Desktop Programming / WTL
Article

Generator for Include File Guards

Rate me:
Please Sign up or sign in to vote.
4.20/5 (2 votes)
18 Jul 2001 55.3K   578   19   2
A little utility that generates header file guards against multiple inclusion.

Sample Image - IncludeGuard.jpg

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.

License

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


Written By
Web Developer
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
General#pragma once Pin
22-Jul-01 22:53
suss22-Jul-01 22:53 
GeneralRe: #pragma once Pin
23-Jul-01 1:56
suss23-Jul-01 1:56 

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

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