Precompiled header stdafx.h
-
Hi everybody. Good morning. I´d like to know what is the precompiled header for, why is ti useful, and what are the differences between Selecting "Not using precompiled headers" or using stdafx.h I´m getting an error message when building on Release version, something like this : Fatal error C1083: Cannot open precompiled header file: 'Release/TMB.pch': No such file or directory I can fix that by selecting Not using precompiled headers, but I want to know why it happens. Thanks!
Time to come clean... Vive y deja vivir / Live and let live Javier
-
Hi everybody. Good morning. I´d like to know what is the precompiled header for, why is ti useful, and what are the differences between Selecting "Not using precompiled headers" or using stdafx.h I´m getting an error message when building on Release version, something like this : Fatal error C1083: Cannot open precompiled header file: 'Release/TMB.pch': No such file or directory I can fix that by selecting Not using precompiled headers, but I want to know why it happens. Thanks!
Time to come clean... Vive y deja vivir / Live and let live Javier
PCHs do pretty much what they say on the tin. Ususally in the MSVC context your PCH is built from
stdafx.h
. This means the compiler takes stdafx.h and everything it#include
s and compiles it first into a special 'pre-compiled' bunch of stuff it puts in the .pch file. Then when it sees#include "stdafx.h"
in some other .cpp file later on it doesn't have to go through stdafx.h and all its included headers again it just links in the pre-compiled stuff from the .pch file it created before. Essentially it's a way of speeding up your builds. :) I don't know exactly why you're seeing this error but what it means is the .pch file has not been built for your Release build. If your settings are consistent. i.e. each .cpp is set correctly to use or not use a .pch and all the ones that use it generate it from the same header, then a full Rebuild should fix this. Sometimes the incremental linker gets confused and thinks the .pch has been built when it hasn't after something is changed that requires it to be rebuilt.Nothing is exactly what it seems but everything with seems can be unpicked.
-
Hi everybody. Good morning. I´d like to know what is the precompiled header for, why is ti useful, and what are the differences between Selecting "Not using precompiled headers" or using stdafx.h I´m getting an error message when building on Release version, something like this : Fatal error C1083: Cannot open precompiled header file: 'Release/TMB.pch': No such file or directory I can fix that by selecting Not using precompiled headers, but I want to know why it happens. Thanks!
Time to come clean... Vive y deja vivir / Live and let live Javier