views:

1983

answers:

3

I've tried everything from reading the Netbeans help to browsing Google. This code works fine in Dev-Cpp but not Netbeans 6.5.1. Netveans also places and exclamation mark next to #include <iostream> which i checked and is in the include path of netbeans and is in the include folder:

#include <iostream>
int main() {
    std::cout << "Test"  << "\n";
    return (0);
}

My build tools are set to:

Family: MinGW

Base Directory: C:\Dev-Cpp\bin

C Compiler: C:\Dev-Cpp\bin\gcc.exe

C++ Compiler: C:\Dev-Cpp\bin\g++.exe

Fortran Compiler: C:\Dev-Cpp\bin\g77.exe

Make Command: C:\Dev-Cpp\bin\make.exe

Debugger Command: C:\Dev-Cpp\bin\gdb.exe

I get error:

Running "C:\Dev-Cpp\bin\make.exe  -f Makefile CONF=Debug" in C:\Documents and Settings\Babiker\Desktop\Temp\Test

! was unexpected at this time.

C:\Dev-Cpp\bin\make.exe: *** [.validate-impl] Error 255


Build failed. Exit value 2.
A: 

This may be irrelevant but you do have your make environment associated with the correct filetypes? So it's not trying to compile a .cpp file with the normal c-compiler or anything like that? I've never used your environment, but something like that is always possible I'd think.

And on that note, your code is IN a .cpp file, and not a .c file? Or maybe you have it in a .cxx file (I've seen that before for C++, rare, but I've seen it), and .cxx isn't associated with C++, so it "defaults" to C for unknown types?

Maybe seeing your makefile will also help offer some insight.

Kevin
+2  A: 

The cause of the error is that Netbeans is incompatible with MinGW's make.

You have a choice of supported make versions:

  • Cygwin's make. Cygwin is a blessing. It brings as much Unix to Windows as you'd like.
  • MinGW's own MSYS, which "is a collection of GNU utilities such as bash, make, gawk and grep to allow building of applications and programs which depend on traditionally UNIX tools to be present". It is also a much smaller download than Cygwin.
akamch
A: 

I tried running this code in netbeans 6.5 and it worked fine. I do not understand from the question how exclamation mark was added.

I suggest checking the linker options to ensure that netbeans is linking correctly to C++ standard library.

You can find this option by right click on project file -> properties.

lava