Netbeans C/C not compiling - c++

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

gcc: Command not found
You should check whether you have installed gcc (plus gdb and make)
via MinGW:
MinGW+NetBeans (just look at the screenshots, you don't have to understand Hungarian)
via Cygwin:
http://www.eecg.utoronto.ca/~aamodt/ece242/cygwin.html
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 in C:\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:

Here is your problem:
gcc: Command not found
Cygwin is not a compiler, it's a unix-like environment for Windows. Gcc is the compiler. You have to install gcc with Cygwin before it will work.

Related

BUILD FAILED Netbeans 7.4 C / C++

I am trying to fix my Netbeans IDE to compile C / C++ programs, but I get the following error:
"/D/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make.exe[1]: Entering directory `/c/Users/MOTIVECODEX/Documents/NetBeansProjects/make'
"/D/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW_TDM-Windows/make.exe
make.exe[2]: Entering directory `/c/Users/MOTIVECODEX/Documents/NetBeansProjects/make'
mkdir -p build/Debug/MinGW_TDM-Windows
make.exe[2]: mkdir: Command not found
make.exe[2]: *** [build/Debug/MinGW_TDM-Windows/main.o] Error 127
make.exe[2]: Leaving directory `/c/Users/MOTIVECODEX/Documents/NetBeansProjects/make'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `/c/Users/MOTIVECODEX/Documents/NetBeansProjects/make'
make.exe": *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 1s)
I have added these to my windows user variables path and also system variables path:
D:\MinGW\bin; D:\MinGW\msys\1.0\bin; D:\MinGW\mingw32\bin;
But still getting this error.
I am using MinGW with MSYS with Netbeans IDE 7.4. Windows 7 64 bit.
I have reïnstalled both MinGW MSYS and Netbeans IDE 7.4. NetBeans IDE 7.4 has C / C++ installed.
Paths in Netbeans:
I know this is a duplicate, but those "solutions" did not work, so
spare me the trouble of marking this as duplicate.
Solution to my problem: Remove MinGW and ALL of it's components, and also remove the folder x:\MinGW. Then install Cygwin, choose the packages you need, tutorial can be found on https://netbeans.org/community/releases/73/cpp-setup-instructions.html#cygwin or YouTube about which packages you need. Then add x:\cygwin to your system path, in my case D:\cygwin64 and reopen Netbeans, go to tools -> options -> C/C++ and click on Restore Defaults. It changed everything to cygwin, in my case cygwin64, and I can build now without errors.
I am making this post about a problem that I encounter when I made a clean and build on a C language program. There was a post about the same problem for a C++ program pointing towards a problem with the main function. This post and the message from the clean and build lead me toward a solution.
When you create a new project:
Categories: C/C++
Projects: C/C++ Application
After you click on Next you should uncheck the Create Main File box before proceeding. You should not have any problems afterward.

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)
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.

run error using MinGW with netbeans 7.3.1

I Installed MinGW and i'm using it with netbeans. However when i try to run a simple "Hello world" programm it gives me the following error:
"/C/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build- conf
make.exe[1]: Entering directory `/c/Users/Notandi/Documents/NetBeansProjects/somegame'
"/C/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW_1- Windows/somegame.exe
make.exe[2]: Entering directory `/c/Users/Notandi/Documents/NetBeansProjects/somegame'
mkdir -p dist/Debug/MinGW_1-Windows
g++ -o dist/Debug/MinGW_1-Windows/somegame build/Debug/MinGW_1-Windows/main.o - lmingw32 -lSDL2main -lSDL2.dll
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot open output file dist/Debug/MinGW_1-Windows/somegame.exe: Permission denied
collect2.exe: error: ld returned 1 exit status
make.exe[2]: *** [dist/Debug/MinGW_1-Windows/somegame.exe] Error 1
make.exe[2]: Leaving directory `/c/Users/Notandi/Documents/NetBeansProjects/somegame'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `/c/Users/Notandi/Documents/NetBeansProjects/somegame'
make.exe": *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 3s)
I have checked if the program is running in background, but it isn't.
im using windows 64bit and using MinGW for c++.
I simply configured NetBeans to use MinGW and faced the same inconveniences, but soon simply
decided to use NetBeans with "Run as an administrator", which helped (and so even made "Run as an administrator" unnecessary in further runs). And on a next week I can reinstall MinGW + MSYS in another manner. I'm citing:
The NetBeans IDE might have issues when you try to build and run projects later if MSYS is installed under a limited user account

Cannot Compile "Hello World" in NetBeans IDE 7.3 with MinGW C++

I'm trying to make a simple "Hello World!" program in NetBeans IDE 7.3 with MinGW as my C++ compiler.
I'm getting build failures and I'm at a loss as to understanding why.
This is my compiler setup:
Family: MinGW
Base Directory: C:\MinGW
C Compiler: C:\MinGW\bin\gcc.exe
C++ Compiler: C:\MinGW\bin\g++.exe
Assembler: C:\MinGW\bin\as.exe
Make Command: C:\MinGW\msys\1.0\bin\make.exe
Debugger Command: C:\MinGW\bin\gdb.exe
I've made sure to that my environment PATH directs to C:\MinGW\bin and C:\MinGW\msys\1.0\bin.
My code is:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!" << endl;
return 0;
}
After trying to build the project, I recieve this message from the NetBeans debug output:
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/c/NetBeansProjects/HelloWorld'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/helloworld.exe
make[2]: Entering directory `/c/NetBeansProjects/HelloWorld'
mkdir -p build/Debug/MinGW-Windows
rm -f build/Debug/MinGW-Windows/main.o.d
g++ -c -g -MMD -MP -MF build/Debug/MinGW-Windows/main.o.d -o build/Debug/MinGW-Windows/main.o main.cpp
make[2]: g++: Command not found
make[2]: *** [build/Debug/MinGW-Windows/main.o] Error 127
make[2]: Leaving directory `/c/NetBeansProjects/HelloWorld'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/c/NetBeansProjects/HelloWorld'
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 1s)
I've search various Q&A, but I seem to be doing everything correctly.
Right click on My Computer and select properties. Click Advanced System Settings.System Properties dialog box will open. click Environmental Variables. Edit PATH variable and add C:\MinGW\msys\1.0\bin
Your settings on netbeans shoud be as follows
Base Directory: C:\MinGW\bin
C Compiler: C:\MinGW\bin\gcc.exe
C++ Compiler: C:\MinGW\bin\g++.exe
Fortran Compiler: C:\MinGW\bin\gfortran.exe
Assembler: C:\MinGW\bin\as.exe
Make Command: C:\MinGW\msys\1.0\bin\make.exe
Debbuger Command: C:\MinGW\bin\gdb.exe
Add these to your Environment variables
C:\MinGW\bin and C:\MinGW\msys\1.0\bin
This can happen if you have set the settings on netbeans before/during the time of installing MINGW and setting the environment PATH.
Just restart netbeans
you download mysys form mingw or sourceforge.net after install it, path is C:\Mysys\1.0\bin\make.exe to give the path into make compiler in netbean ide.

Can't Compile C++ Code on NetBeans 7.0

I just installed NetBeans 7.0 with C++ package. It asked for C++ compiler - I installed MinGW. I added it to NetBeans (so it recognize it). I think that it's all correct...
I wrote very simple C++ application in main.cpp and tried to compile it...
#include <cstdlib>
#include <iostream>
int main( int argc, char** argv ) {
std::cout << "Hello, world!";
return 0;
}
It complains about "Make Command" (under Tools -> Options -> C/C++ -> Build Tools). I tried to fix it and type C:\MinGW\msys\1.0\bin\make.exe in there. I tried to compile it again! Here's the error message...
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/c/Users/admin/Documents/C++/helloWorld'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/helloworld.exe
make[2]: Entering directory `/c/Users/admin/Documents/C++/helloWorld'
make[2]: mkdir: Command not found
mkdir -p build/Debug/MinGW-Windows
make[2]: *** [build/Debug/MinGW-Windows/main.o] Error 127
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
make[2]: Leaving directory `/c/Users/admin/Documents/C++/helloWorld'
make[1]: Leaving directory `/c/Users/admin/Documents/C++/helloWorld'
BUILD FAILED (exit value 2, total time: 2s)
How to fix it and configure NetBeans (with C++ package) correctly?
I guess you didn't add msys to your PATH variable. See this entry in the Netbeans forum, as the error reported there is essentially the same as the one you pasted in your question. So, the error message you received does not complain about make, it complains that it can't find mkdir, which is supposed to be in a directory in your msys directory. Adding C:\MinGW\msys\1.0\bin\ to your windows PATH variable will probably be sufficient to fix this.
mkdir in Cygwin may be a separate .exe instead of a function of bash. So you may be just missing it for some reason.
"Resolve Missing Native Build Tools" Netbeans Make command problem. Go to -Tools -Options -C/C++ Write to Make Command: C:\MinGW\msys\1.0\bin\make.exe
Solution
Copy mingw32-make.exe from MinGW\bin\ to msys folder, replacing make.exe
not sure why this is necessary but, hey, it worked.