Visual Studio: 无法启动程序,系统找不到指定的文件 visual studio 错误?

Visual Studio: Unable to start program, the system cannot find the file specified visual studio error?

这里我使用的是 visual studio 2019 社区版。我从文件->新建->现有项目打开一个文件夹。但是每当我构建 运行 我的程序时。它说

Unable to start program 'O:.Fourth semester\programminh\main\Debug\Main2.exe' the system cannot find the file specified

有很多节目。像 bubble.cpp, binary.cpp 但它 运行s Main2.exe.

这是我的 linear.cpp 文件

#include <iostream>
using namespace std;
int main(){

            int n, an, arr[30], key, i, found=0;
            cout<<"Please enter number of element you want:"<<endl;

            cin>>n;
            cout<<"Please enter the numbers"<<endl;
            for(i=0;i<n;i++){
                cin>>arr[i];
            }


            cout<<"Please Enter the number you want to search"<<endl;
            cin>>key;

            for(i=0;i<n; i++){

                if(arr[i] == key){
                    cout<<"Element found at position "<<i+1;

                    found=1;
                    break;
                }
                }


                if(!found){
                    cout<<"Number Not Found"<<endl;
                }








            return 0;


}

有人可以查一下吗?

I open a folder from file->new->existing project.

据我所知,您应该打开 .sln 文件而不是文件夹。

您只能运行 .sln 文件(Visual Studio 解决方案)而不是 .cpp 文件。