0

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?

voxoid
  • 1,164
  • 1
  • 14
  • 31

1 Answers1

0

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.

voxoid
  • 1,164
  • 1
  • 14
  • 31