[英]Visual Studio 2012. “unable to start program” *.exe “cannot find the file specified”
Yes, I know this is a common question. 是的,我知道这是一个常见问题。 No other question/answer sets meet my needs here.
这里没有其他问题/答案集可以满足我的需求。 Taking c++ this quarter.
本季度学习C ++。 Been going along just fine.
一直很好。 Trying to do last assignment, and I'm getting the above error, even on a fresh project with:
尝试做最后一次分配,即使在一个新项目中,我也遇到上述错误:
#include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
cout << "hello world" << endl;
}
As an experiment, I tried pasting in much more elaborate code from previous assignments. 作为一个实验,我尝试粘贴以前任务中更复杂的代码。 This runs.
运行。 Just pasting in -- not running the previous assignment.
只是粘贴-不运行上一个作业。
I took the simplest of them, and stripped it down to this: 我选择了其中最简单的一个,并将其简化为:
Main.cpp: Main.cpp:
#include <iostream>
using namespace std;
int main()
{
double hours, rate;
cout << "Hello World";
cin >> hours;
cout << "Hello World";
cin >> rate;
system("pause");
return 0;
}
This compiles and runs fine. 这样可以编译并正常运行。 However, if I remove either of the
cin
lines I get the error stated in the title. 但是,如果我删除任何一条
cin
行,都会出现标题中指出的错误。
I'm just flabbergasted because pasted in code compiles and runs, but even "Hello World" in a fresh project won't. 我很吃惊,因为粘贴在代码中可以编译和运行,但是即使在新项目中也无法实现“ Hello World”。
Does my above example provide any clues? 我上面的示例是否提供任何线索?
Does it happen if you run it as administrator? 如果以管理员身份运行它会发生吗? Were you running it from Visual Studio or did you clicked the executable?
您是从Visual Studio运行它还是单击可执行文件?
If you have an anti virus, it may be causing the error as well. 如果您有防病毒软件,它也可能导致错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.