Precompiled Headers with Mixed C and C++

James Linden picture James Linden · Jan 19, 2012 · Viewed 32.2k times · Source

I am using pre-compiled headers in my project in C but we are integrating a .CPP file into the project.

Here's the error:

Error   1   fatal error C1853: 'Debug\MuffinFactory.pch' precompiled header
file is from a previous version of the compiler, or the precompiled header is C++
 and you are using it from C (or vice versa)    
c:\users\blake\desktop\projects\muffinfactory\source\main.cpp   1

We only need a single .CPP compiled in our project, but we really need the pre-compiled header to save compile times (Windows.h and more).

How should I organize my project to do this?

Answer

Bo Persson picture Bo Persson · Jan 19, 2012

So don't use precompiled headers for that single file!

Being a .cpp file, it will have separate compilation options anyway.