mumakurau
mumakurau

Reputation: 41

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:

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.

Upvotes: 4

Views: 19093

Answers (3)

mistaguy
mistaguy

Reputation: 133

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

Upvotes: 1

Chandan Sharma
Chandan Sharma

Reputation: 41

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

Upvotes: 4

GopalKrish
GopalKrish

Reputation: 25

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.

Upvotes: -2

Related Questions