2013-10-28 93 views
0

我有一個小問題使用Netbeans 7.4和Cygwin 4.x編譯我的C++程序。我已經做了netbeans教程中的所有內容。我已經安裝了gcc,gdb,g ++並編譯器。在Netbeans屬性中,每條路徑都可以正確設置。但我仍然遇到同樣的問題,我不知道這是什麼問題。我試圖從Netbeans編譯Hello樣本。請幫幫我。以下是錯誤日誌:Netbeans和C++安裝

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf 
make[1]: Entering directory '/cygdrive/c/Users/Dragosh/Documents/NetBeansProjects/Welcome_2' 
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin_4.x-Windows/welcome_2.exe 
make[2]: Entering directory '/cygdrive/c/Users/Dragosh/Documents/NetBeansProjects/Welcome_2' 
mkdir -p build/Debug/Cygwin_4.x-Windows 
g++ -c -g -o build/Debug/Cygwin_4.x-Windows/welcome.o welcome.cc 
In file included from /usr/include/sys/reent.h:14:0, 
      from /usr/include/wchar.h:6, 
      from /usr/lib/gcc/x86_64-pc-cygwin/4.8.1/include/c++/cwchar:44, 
      from /usr/lib/gcc/x86_64-pc-cygwin/4.8.1/include/c++/bits/postypes.h:40, 
      from /usr/lib/gcc/x86_64-pc-cygwin/4.8.1/include/c++/iosfwd:40, 
      from /usr/lib/gcc/x86_64-pc-cygwin/4.8.1/include/c++/ios:38, 
      from /usr/lib/gcc/x86_64-pc-cygwin/4.8.1/include/c++/ostream:38, 
      from /usr/lib/gcc/x86_64-pc-cygwin/4.8.1/include/c++/iostream:39, 
      from welcome.cc:31: 
/usr/include/sys/_types.h:72:20: fatal error: stddef.h: No such file or directory 
#include <stddef.h> 
       ^
compilation terminated. 
nbproject/Makefile-Debug.mk:66: recipe for target 'build/Debug/Cygwin_4.x-Windows/welcome.o' failed 
make[2]: *** [build/Debug/Cygwin_4.x-Windows/welcome.o] Error 1 
make[2]: Leaving directory '/cygdrive/c/Users/Dragosh/Documents/NetBeansProjects/Welcome_2' 
nbproject/Makefile-Debug.mk:59: recipe for target '.build-conf' failed 
make[1]: *** [.build-conf] Error 2 
make[1]: Leaving directory '/cygdrive/c/Users/Dragosh/Documents/NetBeansProjects/Welcome_2' 
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed 
make: *** [.build-impl] Error 2 


BUILD FAILED (exit value 2, total time: 467ms) 

回答

3

在上次更新到2.830(請參閱setup.exe版本)後,也得到了與cygwin一起的此問題。我正在使用64位版本。要驗證我們是否有同樣的問題,請嘗試使用g ++ usgin cygwin終端手動編譯超級簡單的東西。

我檢查:

$ echo -e "#include <iostream>\n int main() { return 0; }" | g++ -xc++ - 

,並得到:

In file included from /usr/include/sys/reent.h:14:0, 
       from /usr/include/wchar.h:6, 
       from /usr/lib/gcc/x86_64-pc-cygwin/4.8.1/include/c++/cwchar:44, 
       from /usr/lib/gcc/x86_64-pc-cygwin/4.8.1/include/c++/bits/postypes.h:40, 
       from /usr/lib/gcc/x86_64-pc-cygwin/4.8.1/include/c++/iosfwd:40, 
       from /usr/lib/gcc/x86_64-pc-cygwin/4.8.1/include/c++/ios:38, 
       from /usr/lib/gcc/x86_64-pc-cygwin/4.8.1/include/c++/ostream:38, 
       from /usr/lib/gcc/x86_64-pc-cygwin/4.8.1/include/c++/iostream:39, 
       from <stdin>:1: 
/usr/include/sys/_types.h:72:20: fatal error: stddef.h: No such file or directory 
#include <stddef.h> 
        ^
compilation terminated. 

我注意到,有GCC這裏 的C兩個文件夾:\ cygwin的\ LIB \ GCC \ x86_64的-PC-的cygwin \ 4.8.1 C:\ cygwin的\ lib中\ GCC \ x86_64的-PC-cygwin的\ 4.8.2

和g ++ --version給出4.8.2

運行Cygwin的最新Setup.exe並尋找安裝包表明版本的GCC核心和錯配的gcc-G ++:

gcc-core = 4.8.2-1 
gcc-c++ = 4.8.1-3 

我降級GCC-核心4.8.1-3和固定的問題。

+0

當我從4.8.3(Cygwin默認值)升級到4.9.2時,我遇到了類似的問題。我必須運行安裝程序來專門更新gcc-core。 – Kevin