Netbeans C/C not compiling
gcc: Command not found
-
You should check whether you have installed
gcc
(plusgdb
andmake
)-
via MinGW:
MinGW+NetBeans (just look at the screenshots, you don't have to understand Hungarian)
-
via Cygwin:
-
-
You should also check whether paths are correct in NetBeans:
Tools > Options > C/C++ > Build Tools:
(At the time of creating the screenshot, I had MinGW installed in
C:\Programs\MinGW
, BUT if you have it installed inC:\MinGW
(which is the default), this correct, too! The only important thing is that you should install MinGW in a path which doesn't contain whitespaces.)This is what it looks like when paths are incorrect, letters are red:
Note: I have MinGW installed, but it doesn't change the fact that you should check whether YOUR paths are correct.
-
You should also take care the right Configuration is selected in project Properties (right click on project) > Build - The right "Tool collection" has to be selected (on which the paths above are correct):
Unable to start pty process
Related answer: Can build, but can't run C code in netbeans (but it works in command line)
So right click on the project, Properties > Run > Console Type > External Terminal (instead of e.g. "Internal Terminal"). Here is a screenshot:
ABanerjee
Updated on June 04, 2022Comments
-
ABanerjee almost 2 years
I installed the NetBeans IDE 7.3.1 almost a week ago and still haven't been able to get it to compile anything.
I'm using the Cygwin's compiler for C/C++, and I get the following error message for a simple "Hello World" program:"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf make[1]: Entering directory `/cygdrive/c/Users/CaptFuzzyboots/Documents/NetBeansProjects/Hello World' "/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin_1-Windows/hello_world.exe make[2]: Entering directory `/cygdrive/c/Users/CaptFuzzyboots/Documents/NetBeansProjects/Hello World' mkdir -p build/Debug/Cygwin_1-Windows rm -f build/Debug/Cygwin_1-Windows/main.o.d gcc -c -g -MMD -MP -MF build/Debug/Cygwin_1-Windows/main.o.d -o build/Debug/Cygwin_1-Windows/main.o main.c make[2]: gcc: Command not found nbproject/Makefile-Debug.mk:66: recipe for target `build/Debug/Cygwin_1-Windows/main.o' failed make[2]: *** [build/Debug/Cygwin_1-Windows/main.o] Error 127 make[2]: Leaving directory `/cygdrive/c/Users/CaptFuzzyboots/Documents/NetBeansProjects/Hello World' nbproject/Makefile-Debug.mk:59: recipe for target `.build-conf' failed make[1]: *** [.build-conf] Error 2 make[1]: Leaving directory `/cygdrive/c/Users/CaptFuzzyboots/Documents/NetBeansProjects/Hello World' nbproject/Makefile-impl.mk:39: recipe for target `.build-impl' failed make: *** [.build-impl] Error 2 BUILD FAILED (exit value 2, total time: 472ms)
EDIT
I fixed this by just making a new toolkit and adding the base directory as Cygwin -> bin.
The problem now is that I keep getting
Unable to start pty process