[英]Unable to start program, cannot find the file specified, Visual Studio 11
I'm working off of a fresh install of VS 11 Beta, on a Windows 7 64-bit machine. 我正在Windows 7 64位计算机上全新安装VS 11 Beta。 When I try to debug, it gives me this error message. 当我尝试调试时,它给了我这个错误消息。
"Unable to start program 'C:\\Users\\myname\\documents\\Visual Studio 11\\Projects\\Project1\\Debug\\Project1.exe" “无法启动程序'C:\\ Users \\ myname \\ documents \\ Visual Studio 11 \\ Projects \\ Project1 \\ Debug \\ Project1.exe”
I'm almost entirely sure it isn't a problem with my code--it works fine on online compilers, making me think that it's an issue with how I'm saving it. 我几乎完全确定它不是我的代码的问题 - 它在在线编译器上运行良好,让我觉得这是我如何保存它的问题。 Just in case, here it is. 以防万一,这里是。
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
printf("Hello, world!\n");
return 0;
}
My process for creating the project/file is to create a new empty Visual C++ project, then a .cpp file, write my code, save it as a .c inside of the first folder I'm prompted with, within the projects folder, and then try to debug. 我创建项目/文件的过程是创建一个新的空Visual C ++项目,然后创建.cpp文件,编写我的代码,将其保存为我提示的第一个文件夹中的.c,在projects文件夹中,然后尝试调试。
What am I doing wrong, here? 我做错了什么,在这里? I know that the debug folder is empty, but I can't figure out how to create the .exe file that should reside in it. 我知道调试文件夹是空的,但我无法弄清楚如何创建应该驻留在其中的.exe文件。
NB: I'm rather new to programming. NB:我对编程很新。 If answers could be phrased in babyspeak, that would be appreciated. 如果答案可以用babyspeak表达,那将是值得赞赏的。
Well, there could be a number of things wrong. 好吧,可能有很多错误。 However, based on your description of making a ccp file and ac file, I'm betting that it's a problem in your VS 11 project rather than the code itself. 但是,根据您对制作ccp文件和 ac文件的描述,我认为这是VS 11项目中的问题,而不是代码本身。 My guess would be that either the c file didn't get included in your project (check the Solution Explorer) or that you have the main (or _tmain) function defined in both the cpp and the c files, which will make the linker issue an error. 我的猜测是c文件没有包含在你的项目中(查看解决方案资源管理器)或者你在cpp和c文件中都定义了main(或_tmain)函数,这将导致链接器问题一个错误。
There are a bunch of "Hello World" tutorials online for VS 2010 and earlier, but there don't seem to be many for VS 11 Beta yet. 对于VS 2010及更早版本,网上有一堆“Hello World”教程,但VS 11 Beta似乎还没有很多。 You may want to take a look at the 2010 versions. 您可能想看一下2010版本。 I found this video tutorial that you may want to check out. 我找到了您可能想要查看的视频教程 。
Check the output directory. 检查输出目录。 And you can also set manually an output direcotry to save the built exe file. 您还可以手动设置输出目录以保存构建的exe文件。
I know this problem was from May but I thought I would answer with a solution that worked for me: 我知道这个问题来自五月,但我想我会回答一个对我有用的解决方案:
I was creating a .cpp
file in a blank project and was getting a similar error. 我在一个空白项目中创建一个.cpp
文件,并收到类似的错误。 I noticed that the file had a name but was not showing the extension .cpp
. 我注意到该文件有一个名称,但没有显示扩展名.cpp
。 I added the extension to the file ( ex3.18.cpp
) and did not get the .exe
error again. 我将扩展名添加到文件( ex3.18.cpp
)并且没有再次收到.exe
错误。
I don't know if that makes sense with your issue but I worked on this for two days uninstalling and reinstalling VS 11, and this was what finally worked. 我不知道这对你的问题是否有意义,但我在这方面工作了两天卸载并重新安装VS 11,这就是最终的工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.