undefined reference to winmain@16 in cygwin gcc

I'm trying to compile a project in cygwin and I keep getting this error. I have a main so I'm guessing this is a linker issue but I'm not sure why its not linking properly. Are there any gcc flags I should include. I already use "-mno-cygwin" and "-mwindows".
how about removing the -mwindows
Thanks for the reply.

I'm getting the same error even without the -mwindows...
Still having the same problem... any ideas?
Windows GUI programs should have a winmain function and console programs should have
a main function.

The errors happens if you have written a program with a main function, but try building it as
a GUI one.
The linker is trying to link the runtime startup code to the winmain function but can't
find it.
Last edited on
Topic archived. No new replies allowed.