0

The development I have done over the last few years uses a lot of pre-compiled headers. One for each product. The pre-compiled headers are used in a way to #define items that each product needs. This does keep the code rather clean and portable among each product.

But, how does one replicate this approach without using a pre-compiled header?

Basically, be able to #define a fair number of items and some basic includes, but have it not be a PCH.

Do you just create a .h and include this in every class that needs these defines?

can you just rename the .pch to a .h? Structurally it would look the same right? Well, plus a header quard.

UPDATE: This is a codebase that used to use Codewarrior for Mac and Win. Now uses XCode on OS X and We may be migrating to CMake for both Mac and Win to help us not have so many different environments.

Jasmine
  • 15,375
  • 10
  • 30
  • 48

1 Answers1

0

You can use a single include file (.h) and include it everywhere.

However, most build systems also provide a way to add #defines on a project scope. For example, in Visual Studio, the Preprocessor section of the project properties allows you to place build-specific defines that are project wide.

Reed Copsey
  • 554,122
  • 78
  • 1,158
  • 1,373