I'm using precompiled headers in my Visual Studio (2019) C++ project, and am including "pch.h" at the top of my source files, have #pragma once
at the top of each header file, and a pch.cpp file (generated by the project template). Yet for one of the source files I get compiler error C1010: "Unexpected end of file while looking for precompiled header. Did you forget to add '#include "pch.h"' to your source?" What other causes are there for this error?
0
votes
1 Answers
0
votes
In my case, I had a corrupt cpp source file (a different one from where the error was occurring), caused by an earlier sudden power failure. It seems that once I recreated the corrupt file, the project was back into a valid state and the error went away the next time I built. ...It was a bit of a corner case, but you might clean/rebuild and check that nothing is corrupt.
#pragma once
(include guard) on top of the header file? – NutCracker