Why do I need a WinMain() if I include <windows.h> under cygwin but not if I use MSVC?

As the topic says…if I include <windows.h> in my SDL program written
in C++ I need to replace main() with WinMain() for the linker to link
if I’m compiling under cygwin (using mingw sdl binaries). However, if
I use the same code in SDL with MSVC++ it works with main(). This
annoying and it would be nice to solve it.

/ E

Hello Eric,

Friday, November 3, 2006, 11:31:56 PM, you wrote:

As the topic says…if I include <windows.h> in my SDL program written
in C++ I need to replace main() with WinMain() for the linker to link
if I’m compiling under cygwin (using mingw sdl binaries). However, if
I use the same code in SDL with MSVC++ it works with main(). This
annoying and it would be nice to solve it.

If the linker says WinMain() is missing, you are not doing -lSDLmain
with mingw.–
Best regards,
Peter mailto:@Peter_Mulholland

Peter Mulholland wrote:

Hello Eric,

Friday, November 3, 2006, 11:31:56 PM, you wrote:

As the topic says…if I include <windows.h> in my SDL program written
in C++ I need to replace main() with WinMain() for the linker to link
if I’m compiling under cygwin (using mingw sdl binaries). However, if
I use the same code in SDL with MSVC++ it works with main(). This
annoying and it would be nice to solve it.

If the linker says WinMain() is missing, you are not doing -lSDLmain
with mingw.

I don’t have to. I solved it by chaning the include order of the headers.

/ E