2017-09-06 59 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

我的不好,我最初改變它看看是否能解決這個錯誤。同樣的錯誤仍然發生 –

相關問題