can't start the program in Microsoft Visual Studio 2017 can't find the specified file

Creating a project: File > New > Project... > Empty Project

Creating a file: File > New > File.. > C++ File

I write a standard program " Hello, world!"

#include <iostream>
#include <cstdlib>

using namespace std;

int main()
{
     cout << "Hello, world!" << endl;
     system("pause");
     return 0;
}

I press ctrl+f5. There is a build, there are no errors in the code, but the error pops up "can't start the program "path to the exe file" Can't find the specified file.

Screenshot

The exe file itself is not on this path, it is not even created.

I would be grateful for your help.

Author: sandmanager, 2019-04-01

1 answers

You do not just need to create a file, but create and add it to the project. This is done so, in solution explorer, right-click on Source Files, select Add - >New Item. If you already have a file created, as it is now, then select Add->Existing Item and select your file

 1
Author: helldrg, 2019-04-01 15:34:28