Share via

"C1010: Unexpected end of file" occurred even after disabling precompiled header (VC++2019)

Stan Huang 421 Reputation points
2021-01-25T11:35:03.57+00:00

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

According to lots of answers found from web, I know the precompiled headers can be disabled from project and file properties, I did it (disabled precompiled headers from project and file), but I still got such error message. How come?

Developer technologies | C++
Developer technologies | C++

A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.


Answer accepted by question author

  1. David Lowndes 4,731 Reputation points
    2021-01-25T11:47:30.68+00:00

    Have you perhaps changed the setting for one configuration (DEBUG), and not the other (RELEASE)?

    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Stan Huang 421 Reputation points
    2021-01-26T02:06:01.597+00:00

    I found there are three items at the configuration: Debug, Release, and Active(Release). The currently selected one is 'Debug'. Is anything wrong here?

    1 person found this answer helpful.
    0 comments No comments

  2. Stan Huang 421 Reputation points
    2021-01-26T03:33:31.477+00:00

    I changed the configuration (debug) to consistent with the one at toolbar, rebuilt it. It worked then.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.