Search code examples
c++netbeanscygwin

Netbeans and C++ installation


i have a litle problem using Netbeans 7.4 and Cygwin 4.x for compiling my C++ programms. I've done everything as in netbeans tutorial. I've installed gcc, gdb, g++ and make compilers. Everything is setup properly in Netbeans properties, every path. But i still get the same problem, i don't know what is this problem. I'm trying to compile Hello sample from Netbeans. Please help me. Here is the error log:

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

Solution

  • Got this issue with cygwin too, after last update to 2.830 (see setup.exe version). I am using 64 bit version. To verify that we have the same issue, try manualy compiling something supersimple with g++ usgin cygwin terminal.

    I checked with:

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

    And got:

    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.
    

    I noticed that there are two folders of gcc here C:\cygwin\lib\gcc\x86_64-pc-cygwin\4.8.1 C:\cygwin\lib\gcc\x86_64-pc-cygwin\4.8.2

    and g++ --version gives 4.8.2

    Running Cygwin's latest Setup.exe and looking for installed packets showed that versions mismatch for gcc-core and gcc-g++ :

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

    I downgraded gcc-core to 4.8.1-3 and fixed the issue.