Precompiled headers question

Posted by Kotti on Stack Overflow See other posts from Stack Overflow or by Kotti
Published on 2010-06-15T13:37:53Z Indexed on 2010/06/15 14:02 UTC
Read the original article Hit count: 472

Hello!

I am right now reorganizing my project and what recently was a simple application now became a pair of C++ projects - static library and real application.

I would like to share one precompiled header between two projects, but face some troubles with setting up the .pdb file paths.

Assume my first project is called Library and builds it's .lib file with a corresponding Library.pdb file. Now, the second project is called Application and builds everything into the same folder (.exe and another Application.pdb file).

Right now my both projects create their own precompiled headers file (Library.pch and Application.pch) based on one actual header file. It works, but I think it's a waste of time and I also think there should be a way to share one precompiled header between two projects.

If in my Application project I try to set the Use Precompiled Header (/Yu) option and set it to Library.pch, it wouldn't work, because of the following error:

error C2858: command-line option 'program database name "Application.pdb" inconsistent with precompiled header, which used "Library.pdb".

So, does anyone know some trick or way to share one precompiled header between two projects preserving proper debug information?

© Stack Overflow or respective owner

Related posts about c++

Related posts about visual-studio