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

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

I have a setup, so stdafx.cpp will create a precompiled stdafx.pch header from stdafx.h. Then, all other .cpp files that contain stdafx.h are encouraged to use a precompiled header.

These posts helped me get this far:

  • Visual C ++ Precompilation Errors
  • Precompiled Headers

Now everything is fine when I create in release mode. However, when I try to build in debug mode, I get a whole bunch of errors saying:

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

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

Why am I getting this error? In other words, why didn't he use this .idb file when he created the precompiled header?

I'm not sure what additional information you need to give me an answer, so just ask if there is any additional information that I need to provide.

+7
debugging visual-c ++ visual-studio-2010 precompiled-headers
source share
5 answers

Thanks to a colleague, I got an answer.

The problem was that the debug format was installed in stdafx.cpp for the program database (/ Zi), where, like all other files, it was installed in the program database for editing and continuation (/ ZI).

By changing them all in the database of the program for editing and continuing (/ ZI) and performing a complete overhaul, the problem is solved.

I guess the update somehow screwed it.

+4
source share

select Disable for Formatted information format on the Properties page for stdafx.cpp, then go back and select Inherit from the parent who worked for me.

+1
source share

I hit this error with VS2005 when compiling a project where $(ProjectName) is different from the actual project output file (i.e. Linker > Output File not set to the default value of $(OutDir)\$(ProjectName).exe but $(OutDir)\$(ProjectName).exe something else like $(OutDir)\$(ProjectName)-custom_postfix.exe )

In this case, apparently, only when performing the Rebuild-Project-Only operation, then vc80.pdb seems to have looked wrong.

What helped me was to additionally set C/C++ > Output Files > Progam Database File Name to $(IntDir)\$(TargetName).pdb . (Instead of the standard vc80.pdb )

+1
source share

Perhaps your build version is configured to write the file [deleted] \ debug \ vc100.idb instead of [deleted] \ release \ vc100.idb? Check the project settings for the release build and make sure that there are no such hard path components.

0
source share

Here's how I just fixed this error in Visual Studio 2008:

Background:

  • I have a solution that contains two subprojects.
  • One project compiles .dll;
  • One project compiles .exe that used this .dll;
  • The .exe project depends on the .dll project;
  • Problem: I had both projects dumping their output to the same directory, that is, both "OutPutDirectory" and "IntermediateDirectory" were configured to write to the shared directory in the root directory "../$ (ConfigurationName)".

The reason for the error:

  • The reason for this error was that when the .dll project was compiled, it created a precompiled header (* .pch) in the same directory as the .exe directory, and when the .exe project was compiled, it quickly overwritten the precompiled header ( * .pch) from the .dll project.

Correction:

  • To fix this, I changed the "IntermediateDirectory" for both subprojects to "temp" so that temporary files (including precompiled header files) are written to different directories.
0
source share

All Articles