Netbeans和C ++安装

时间:2013-10-28 18:51:14

标签: c++ netbeans cygwin

我使用Netbeans 7.4和Cygwin 4.x来编译我的C ++程序时遇到了问题。我已经完成了netbeans教程中的所有操作。我已经安装了gcc,gdb,g ++和make编译器。在Netbeans属性,每条路径中都可以正确设置所有内容。但我仍然遇到同样的问题,我不知道这是什么问题。我正在尝试从Netbeans编译Hello示例。请帮我。这是错误日志:

"/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)

1 个答案:

答案 0 :(得分:3)

在上次更新到2.830之后,也遇到了cygwin的这个问题(请参阅setup.exe版本)。我使用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-core和gcc-g ++的版本不匹配:

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

我将gcc-core降级为4.8.1-3并解决了问题。