0

Sometimes it would be useful to know whether the compiler requires a pre-compiled header or not, and how the header file is called. My goal is to add some preprocessor directives like this:

#ifdef REQUIRES_PRECOMPILED_HEADER
#include PRECOMPILEDHEADER_FILE
#endif

So my question is: Are there predefined variables like REQUIRES_PRECOMPILED_HEADER and PRECOMPILEDHEADER_FILE?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Christoph Meißner
  • 1,511
  • 2
  • 21
  • 40

2 Answers2

1

It's not your task to support others' use of precompiled headers. It's up to them to add your header to their precompiled header, or not. You just create trouble by trying to do it for them.

So, problem solved: don't do that.

It's unnecessary and it creates trouble.

Cheers and hth. - Alf
  • 142,714
  • 15
  • 209
  • 331
1

Well presumably your source files will not need any of the headers included in the precompiled header. So, if you are trying to include your source files in a project where other source files do use precompiled headers, just make sure precompiled headers are turned off for yours.

Just select the properties for your source files, and under "Precompiled Header" select "Not Using Precompiled Headers".

zdan
  • 28,667
  • 7
  • 60
  • 71
  • Okay that solves the problem in the easy way. (I usually avoid using pre-compiled headers, so I'm not really used to them. Thanks for that hint.) – Christoph Meißner Jun 19 '12 at 09:18