Ting Sun
Ting Sun

Reputation: 173

fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?

I'm getting the following error while compiling my project:

fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?

But if I add #include "StdAfx.h" as it required, more error will appear. What should I do please?

Upvotes: 4

Views: 15296

Answers (1)

patthoyts
patthoyts

Reputation: 33193

This is a Visual Studio issue with precompiled headers. If you compile a file and request precompiled headers you have to include this stdafx file. If you disable use of precompiled headers for either the project or for the file then you no longer have to include this header. Look though the project settings for the right checkbox or check the /Y options you are passing. /Y- can disable precompiled header usage.

Upvotes: 4

Related Questions