fatal error C1010 - “stdafx.h” in Visual Studio how can this be corrected?

后端 未结 3 1252
粉色の甜心
粉色の甜心 2020-12-04 14:18

I compile the following code but I get a compile error in Visual Studio that I cannot understand.

#include 

using namespace std;

int main()         


        
相关标签:
3条回答
  • 2020-12-04 14:46

    Create a new "Empty Project" , Add your Cpp file to the new project, delete the line that includes stdafx.

    Done.

    The project no longer needs the stdafx. It is added automatically when you create projects with installed templates. enter image description here

    0 讨论(0)
  • 2020-12-04 14:51

    Look at https://stackoverflow.com/a/4726838/2963099

    Turn off pre compiled headers:

    Project Properties -> C++ -> Precompiled Headers
    

    set Precompiled Header to "Not Using Precompiled Header".

    0 讨论(0)
  • 2020-12-04 14:54

    The first line of every source file of your project must be the following:

    #include <stdafx.h>
    

    Visit here to understand Precompiled Headers

    0 讨论(0)
提交回复
热议问题