views:

1644

answers:

2

This worked without error when this solution worked off of .lib files instead of .dll files.

I have all of my projects except one currently using a precompiled header, without error. The precompiled header is called "LudoGlobal.h". I am trying to link the last project to this precompiled header (which exists in a seperate, "Core", project) but I'm getting the following error:

Error 4 fatal error C1083: Cannot open precompiled header file: '....\Output\LudoSound\Debug\LudoSound.pch': No such file or directory ludosoundmanager.cpp 1

for each .cpp file. Why is this? How can I solve it?

I realize LudoSound.pch does not exist. I am under the assumption that it probably gets created when LudoSound compiles, yesno?

+4  A: 

Are you using "automatically generate", or "use precompiled header" on the project and "create precompiled header" on the one cpp file? The latter is more efficient, but I've seen the per-file configuration on projects get accidentally reset, so that the "stdafx.cpp" (or whatever) file no longer generates the precompiled header.

Tim Sylvester
I'm using Use PrecompiledHeader (/Yu). with Create/Use PCH Through File Ludocore\LudoGlobal.h. LudoGlobal is my precompiled header
4501
You need to have one cpp file (LudoGlobal.cpp) that includes the .h file and has the proper configuration settings different from all the other .cpp files.
Mark Ransom
I have the one .cpp file, but what configuration settings are you speaking of? Note that this is workign as a precompiled header for several other projects..
4501
You need to go to "properties" for that one .cpp file (as opposed to the project properties) and set it to "Create Precompiled Header".
Tim Sylvester
It is already set up for this. Sorry for the confusion.
4501
So the `LudoGlobal.cpp` file is set to "Create Precompiled Header", but when you compile that cpp file, no pch file is generated *and* no errors occur? Maybe the intermediate/output directories (or the pch file location) don't match so the other files are looking for it in a different place than it's generated in. When you rebuild the project, does it always build `LudoGlobal.cpp` first? Can you post the .vcproj file?
Tim Sylvester
A: 

Try rebuilding your project in a new, copying only the files needed supplies.

lsalamon
this project is incredibly tightly-coupled. i, unfortunately, need it all.
4501
Restore project backup and try this version.
lsalamon