2017-09-06 42 views
-4

我是C新手,所以我在Visual Studio上编写真正基本的代码。第一个节目(的Hello World)制定出完美的,但是当我添加了第二个程序(一环),我得到“无法启动程序...系统找不到指定的文件”错误在Visual Studio中写入C

无法启动程序时,系统可能无法找到指定的文件

精确错误(我加入了隐私原因,文件路径为3个点)

----- 
Microsoft Visual Studio 
--------------------------- 
Unable to start program 'C:\Users ... Learning Projects\Learning\Debug\Learning.exe'. 

The system cannot find the file specified. 

第一个程序:

#include <stdio.h> 
//links the program with the standard input output file 
//contains functions like printf 

//main function 
int main() { 

    printf("hello World \n"); 
    return (0); 
} 

第二套方案:

#include<stdio.h> 

int main() { 

    int ch; 
    for (ch = 75; ch <= 100; ch++) { 
     printf("ASCII value = %d, Character = %c\n", ch, ch); 
    } 

    return (0); 
} 

这可能是一个愚蠢的问题,但我无法找出是什么原因造成的。

+2

,请注意输出窗口,当你编译。它会告诉你,如果构建成功或失败,如果失败它会告诉你为什么。 –

+0

谢谢!我看,显然我不能有一个单一的项目或多个main()函数? –

回答

1

您错误地使用了#include。编译器告诉你它找不到你希望包含的文件。

当你说

#include "stdio.h"" 

你应该说不是

#include <stdio.h> 
+1

但是'#include“stdio.h”'也带有单尾双引号也可以运行 –

+0

@BasileStarynkevitch也许,但这会在两个程序中引入不必要的差异。特别是在学习时,一次应该改变一件事。 –

+0

我的不好,我最初改变它看看是否能解决这个错误。同样的错误仍然发生 –

相关问题