Visual Studio2019无法启动程序

Visual Studio 2019 is unable to start program

我正在尝试学习 C++,所以我开始关注 microsoft's calculator tutorial 这是我目前的代码

#include "stdafx.h"
#include <iostream>

using namespace std;

int main()
{
    cout << "Calculator Console App" << endl << endl;
    cout << "Enter an Operation from the following operations, a+b, a-b, a*b, a/b" << endl;

    return 0;
}

然而,当我在没有调试的情况下按 CTRL+F5 启动时,我得到了这个错误: Unable to start program 'C:\Users\Clark\source\repos\Calculator\Debug\Calculator.exe'. The system cannot find the file specified

#include "stdafx.h" 行中的 #include 下面也有一条红线,每当我将鼠标悬停在它上面时,它都会显示 cannot open source file "stdafx.h"

我该如何解决这个问题,以便我的代码实际上 运行?

stdafx.h 是预编译的 header ,除非您面临编译时间缓慢的情况,否则这是不必要的。因此,您可以删除以下行:#include "stdafx.h" 并继续您的程序。

祝你在 C++ 的旅途中好运!