Visual Studio:无法启动程序,系统找不到指定的文件 Visual Studio 错误? [英] Visual Studio: Unable to start program, the system cannot find the file specified visual studio error?
问题描述
这里我使用的是 Visual Studio 2019 社区版.我从文件-> 新建-> 现有项目中打开一个文件夹.但是每当我构建和运行我的程序时.它说
Here I'm Using visual studio 2019 community edition. I open a folder from file->new->existing project. But whenever i build and run my program. it says
无法启动程序 'O:\1.Fourth学期\programminh\main\Debug\Main2.exe'系统找不到指定的文件
Unable to start program 'O:\1.Fourth semester\programminh\main\Debug\Main2.exe' the system cannot find the file specified
有很多程序.像bubble.cpp、binary.cpp,但它运行Main2.exe.
There are lots of programs. like bubble.cpp, binary.cpp but it runs 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 文件而不是文件夹.
As far as I'm concerned you should open a .sln file instead of a folder.
您只能运行 .sln 文件(Visual Studio 解决方案)而不是 .cpp 文件.
You could only run the .sln file (Visual Studio Solution) not a .cpp file.
这篇关于Visual Studio:无法启动程序,系统找不到指定的文件 Visual Studio 错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!