How do I eliminate error C2859 when trying to use a precompiled header with VS2010 (VC100) in debug mode?

steinybot picture steinybot · Jul 1, 2010 · Viewed 10.5k times · Source

I am trying to upgrade an old solution to use VS2010 (VC100).

I have it setup so that stdafx.cpp will create a precompiled header stdafx.pch from stdafx.h. Then all the other .cpp files that include stdafx.h are instructed to use the precompiled header.

These posts helped me get this far:

Now all is fine when I build in release mode. However when I try and build in debug mode I get a whole heap of errors saying:

Error 1 error C2859: [removed]\debug\vc100.idb is not the idb file that was used when this precompiled header was created, recreate the precompiled header.

I believe that this .idb file is an intermediate debug file created by Visual Studio.

Why am I getting this error? In other words why did it not use this .idb file when it created the precompiled header?

I'm not sure what further information you need to be able to give me answer so just ask if there is more information that I need to provide.

Answer

steinybot picture steinybot · Jul 2, 2010

Thanks to a colleague I got the answer.

The problem was that stdafx.cpp had Debug Information Format set to Program Database (/Zi) where as all the other files had it set to Program Database for Edit and Continue (/ZI).

Changing them all to Program Database for Edit and Continue (/ZI) and doing a full rebuild solved the problem.

I guess the upgrade screwed it up somehow.