1

I'm trying to compile a simple "Hello" program on Windows 7 x64:

#include <cstdlib> 
#include <iostream>

using namespace std;

int main(int argc, char** argv) {
    cout << "Hello" << endl;
    return 0;
}

And getting an error in the NetBeans IDE when compiling:

CLEAN SUCCESSFUL (total time: 126ms)

D:\GDrive\CS\Cpp\NetBeans_Cpp\TNB_cpp\Tut1_10_HelloWorld\Makefile -f nbproject/Makefile-Debug.mk build/Debug/MinGW-Windows/main.o
Cannot run program "D:\GDrive\CS\Cpp\NetBeans_Cpp\TNB_cpp\Tut1_10_HelloWorld\Makefile" (in directory "D:\GDrive\CS\Cpp\NetBeans_Cpp\TNB_cpp\Tut1_10_HelloWorld"): CreateProcess error=193, %1 is not a valid Win32 application

COMPILE FILE FAILED (exit value -2, total time: 16ms)

My PATH env variable looks like this:

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;F:\Program_Files\JDK\bin;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;F:\Program_Files\MinGW\bin;F:\Program_Files\MinGW\msys\1.0\bin;

The last two varibles being probably the most important since they pertain to the MinGW. My ideas is that something is missing in the PATH, but maybe its not where the problem hiddes.

Thanks.

5
  • 1
    Looks to me like the Makefile is broken. Commented Jan 26, 2014 at 18:17
  • 2
    You're trying to run a program called 'Makefile' -- that's probably not right. Makefiles are generally run by a program called make. Commented Jan 26, 2014 at 18:18
  • I basically used a default makefile generated by the NetBeans when creating a project. Maybe it is not broken but was never set up properly in the first place? I just saw that creating make files is a lesson in itself - is there a way to run c++ without them in netbeans with MinGW ? Commented Jan 26, 2014 at 18:21
  • 1
    @MindaugasBernatavičius Post your Makefile, it can give us a hint. Go to project properties -> Build: take a look in 'Configuration Type', just to make sure you are building an application and not a library, for instance. PS. Go to Project->Properties->Linker: What is in the 'output' field? Commented Jan 26, 2014 at 19:52
  • @moskito-x could you please add this as an answer so I can accept it. You identified it correclty./ Commented Jan 29, 2014 at 5:39

1 Answer 1

2

It looks as if some settings are wrong.
Look at your Netbeans settings : Toolchain : Make Command

looking after one of the files.

  • make.exe
  • mingw32-make.exe.

In the directories, for example,

  • c:\msys\1.0\bin
  • c:\MinGW\bin

goto -> options -> c/c++ -> Build Tools
and check if the settings match this

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.