I compile the following code but I get a compile error in Visual Studio that I cannot understand.
#include
using namespace std;
int main()
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.
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"
.
The first line of every source file of your project must be the following:
#include <stdafx.h>
Visit here to understand Precompiled Headers