2012-07-29 43 views
2

我想創建我的第一個C++可執行程序使用Eclipse在Windows 7Eclipse的C++:這個詞上的 'printf' 的拼寫不正確

#include <stdio.h> 
int main(int argc, const char* argv[]) 
{ 
printf("arg"); 
} 

我得到錯誤:

" The word 'printf' is not correctly spelled".

以下是我的配置。如何克服這個錯誤?

enter image description here

enter image description here

enter image description here

+4

您確定您的文件具有擴展名.c或.cpp嗎? – SJuan76 2012-07-29 15:14:04

+3

我見過的最有趣的編譯器錯誤信息:) – jahhaj 2012-07-29 15:18:16

回答

7

好像你沒有給你的C++源被識別爲標準的C++文件擴展名的擴展名。

您可以將您的文件重命名爲main.cpp這樣eclipse會相應地處理它嗎?

4

您可以嘗試使用該程序更改文件的擴展名。正如我所看到的,它現在只是Main(沒有任何擴展名),eclipse將它視爲一個簡單的文本文件,從而執行拼寫檢查。如果你把它改爲Main.c或Main.cpp,一切都應該沒問題。