Xref: utzoo comp.lang.c:23281 comp.lang.c++:5221 gnu.g++:475 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!hellgate.utah.edu!helios.ee.lbl.gov!ncis.tis.llnl.gov!lll-winken!arisia!sgi!shinobu!odin!delrey!shap From: shap@delrey.sgi.com (Jonathan Shapiro) Newsgroups: comp.lang.c,comp.lang.c++,gnu.g++ Subject: Re: A solution to the multiple inclusion problem Message-ID: <1088@odin.SGI.COM> Date: 24 Oct 89 23:07:03 GMT References: <14240@well.UUCP> <2051@prune.bbn.com> Sender: news@odin.SGI.COM Organization: Silicon Graphics, Inc., Mountain View, CA Lines: 28 Okay, here's another cute trick. Have an include file called include-files.h, which contains things like #define FRED_H "fred.h" #define WILMA_H "wilma.h" include them by doing the following in all source files: #include "include-files.h" // done once in all source files #include FRED_H #include ... inside FRED_H do the following: #ifdef FRED_H #undef FRED_H #define FRED_H /dev/null #endif This works, doesn't require much overhead, and can be automatically done applied to existing code by a fairly simple shell script. Jonathan S. Shapiro Synergistic Computing Associates