4

I have mixed C++ project (managed and unmanaged). The unmanaged is using lots of libraries such as boost. They are all included in the stdafx.h file. I am trying to have two separate precompiled headers, one managed (stdafx.h) and one for unmanaged (stdafxManaged.h). How ever when I include the stdafxManaged.h from my Managed code I get an error saying:

error C2855: command-line option '/clr' inconsistent with precompiled header

So I turn the Common Language RunTime Support (/clr) on for the stdasfManaged.cpp and get the following error:

error C1852: 'Debug\xxx.pch' is not a valid precompiled header file

Where xxx is the name of the project and it shows as an error for all of the unmanaged .cpp files in the project.

Does anyone know how to fix this error or have any link to a tutorial which tells you how to setup multiple precompiled headers for a mixed code?

Miro Bucko
  • 1,123
  • 1
  • 13
  • 26

1 Answers1

4

This is actually possible. Make sure that /clr is active for the .cpp file and both the precompiled header file and precompiled header output file settings are different from the regular stdafx.h and $(TargetName).pch.

lowglider
  • 1,087
  • 2
  • 11
  • 21