當我編譯使用程序只是Cygwin的海灣合作委員會在IDE失敗抱怨「退出」未申報
gcc code.c
有沒有消息,並且成功生成的輸出文件。輸出的文件起作用。然而,當我嘗試在同一Cygwin安裝的gcc編譯器在IDE(我試過Netbeans和開發 - C++),我收到以下錯誤
main.cpp:27: error: `exit' undeclared (first use this function)
main.cpp:27: error: (Each undeclared identifier is reported only once for each function it appears in.)
main.cpp:77: error: `write' undeclared (first use this function)
main.cpp:78: error: `close' undeclared (first use this function)
我看不出有什麼不同了。爲什麼不編譯?
好的,問題是在IDE中,文件有一個.cpp擴展名,而當我從終端編譯時,它有一個.c擴展名。所以,我的新問題是爲什麼當它被當作C++文件處理時它不會編譯。 C不是C的子集嗎?
你可以發佈代碼嗎? – ergosys
你有沒有'#include'? –