c++ - Precompiled headers question -
I am currently restructuring my project and recently a simple application has now become a couple of C ++ projects Is - stable library and actual application .
I would like to share a precompiled header between two projects, but .pdb
file path.
My first project is called library
and it should be related to the .lib
file related to Library.pdb
file now, the second The project is called app
and creates everything in the same folder ( .exe
and another Application.pdb
file).
Now make my own precompold header file ( Library.pch
and Application.pch
) based on both of my projects . A real header file does this work, but I think it is a waste of time and I also think there should be a way of sharing a precompelled header among the two projects.
If the project
in the application tries to set , set the Precompiled Header (/ Yu)
option and assign it to < Code> Library.pch , this will not work for the following reasons:
Error C2858: Command Line Options 'Program Database Name' Application.pdb "precompiled Header Is incompatible with which "Library.pdb" was used.
So, between the two projects of conserving proper Debug information, Do some tricks or ways to share a precompiled header?
The question is, why do you want to share the precompiled header (PCH) files? Generally I say, it does not make sense. PCH not to share any information between different projects to speed up the compilation
Since you also write about the PDB file, Want to debug the library code with industries. This library can be obtained by setting the / FD parameter while compiling. When you link the library to your application and the linker finds this same PDB file, you get full debug support.
Comments
Post a Comment