Windows – eclipse + cdt + mingw + windows error “undefined reference to `WinMain@16′” on build

eclipseeclipse-cdtmingwwindows

I installed eclipse, cdt and mingw on my windows XP machine. added C:\MinGW\bin to my PATH.

Created a new c++ project, with one file in it, test.c. the code in it:

int main(){
   int i=1;
}

Trying to build, I get the error:
/mingw/lib/libmingw32.a(main.o):main.c:(.text+0xd2): undefined reference to 'WinMain@16'

Notice it's not complaining about test.c but rather about some main.c in one of mingw's libs.

What am I doing wrong?

Best Answer

You need to save the .c file first.

Related Topic