Search code examples
c++cvisual-studioprecompiled-headers

Precompiled Headers with Mixed C and C++


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?


Solution

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

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