2
我正在使用cygwin庫在Windows上運行C和C++程序。g ++沒有正確鏈接頭文件
gcc
運行正常,但與g++
,我收到一長串的錯誤。我認爲這些錯誤是因爲與C庫鏈接問題。
你能建議我需要做什麼來解決這個問題嗎?
開始錯誤行:
In file included from testgpp.cpp:1:
/cygdrive/c/cygwin/bin/../lib/gcc/i686-pc-cygwin/3.4.4/include/c++/cstdio:52:19: stdio.h: No such file or directory
In file included from testgpp.cpp:1:
/cygdrive/c/cygwin/bin/../lib/gcc/i686-pc-cygwin/3.4.4/include/c++/cstdio:99: error: `::FILE' has not been declared
/cygdrive/c/cygwin/bin/../lib/gcc/i686-pc-cygwin/3.4.4/include/c++/cstdio:100: error: `::fpos_t' has not been declared
/cygdrive/c/cygwin/bin/../lib/gcc/i686-pc-cygwin/3.4.4/include/c++/cstdio:102: error: `::clearerr' has not been declared
/cygdrive/c/cygwin/bin/../lib/gcc/i686-pc-cygwin/3.4.4/include/c++/cstdio:103: error: `::fclose' has not been declared
/cygdrive/c/cygwin/bin/../lib/gcc/i686-pc-cygwin/3.4.4/include/c++/cstdio:104: error: `::feof' has not been declared
整個錯誤轉儲: PasteBin
人們要求的源代碼:這這顯然是一個頭文件鏈接並且在編譯開始之前發生。每個.cpp文件都會得到相同的錯誤。
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
int main(){
cout<<"hello world!";
}
給了我一個非常相同的錯誤。
什麼是命令行? – 2010-04-25 05:59:09
@Marcelo Cantos:'g ++ testgpp.cpp' – Moeb 2010-04-25 06:04:34
沒有看到更多的細節,我不能給你一個答案,但如果你包含「windows.h」......已知與Cygwin的交互性很差,並且可能會有時會導致與上述類似的錯誤。 – 2010-04-25 06:05:49