Cannot compile "Hello World" in NetBeans IDE 7.3 using MinGW C ++

I am trying to make a simple "Hello World!" in NetBeans IDE 7.3 with MinGW as my C ++ compiler.

I'm having build failures and I don’t understand 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 the command: C: \ MinGW \ msys \ 1.0 \ bin \ make.exe
  • Debugger Command: C: \ MinGW \ bin \ gdb.exe

I made sure that my PATH environment points 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 create a project, I get this message from 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.od g++ -c -g -MMD -MP -MF build/Debug/MinGW-Windows/main.od -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 am looking for various Q&A, but I seem to be doing everything right.

+4
source share
3 answers

Right-click My Computer and select properties. Click "Advanced system settings." The System Properties dialog box opens. Click Environmental Variables. Change the PATH variable and add C: \ MinGW \ msys \ 1.0 \ bin

+4
source

Your settings on netbeans will 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 them to environment variables

 C:\MinGW\bin and C:\MinGW\msys\1.0\bin 

This can happen if you set the settings on netbeans before / during the installation of MINGW and the setup of the PATH environment.

Just restart netbeans

+1
source

you load mysys form mingw or sourceforge.net after installation, the path is C: \ Mysys \ 1.0 \ bin \ make.exe to indicate the path to the make compiler in netbean ide.

-2
source

All Articles