dependency on mingw32 lib on MinGW w64 build environment |
qzole
|
Hi!
I started using SDL2 for a new project. Wanted to use a c++ wrapper, so started using SDL2pp, but got into a bit of complication with building on Windows with MinGW. After some discussion, we somewhat solved the problem, but a curious question remained open. Why is the -lmingw32 flag needed for compilation of projects on windows with MinGW? Without it, there is an undefined reference for WinMain, even if -lSDL2main is used. The most bizarre thing for me is that the undefined reference originates from libmingw32.a!
Here is the complete discussion on SDL2pp's github page: https://github.com/libSDL2pp/libSDL2pp/issues/66 Thanks for anyone who can help! |
|||||||||||||
|
Nathaniel J Fries
|
or perhaps SDL2main is linked BEFORE default libs somehow?
|
|||||||||||
|
qzole
|
Sorry, I think I wasn't clear, it's independent of SDL2pp.
Given a simple SDL2 program:
I can compile this with a CMake, using pkg-config to find the SDL2 dependency. The compilation output with make VERBOSE=1:
My question is why is -lmingw32 among the linker flags, why is it needed? Shouldn't it be linked by default? Trying to minimize the compilation, this is what works:
But if I leave out -lmingw32, then the undefined error comes even though SDL2main is linked:
So any ideas? Or should I search around MinGW? |
|||||||||||||||||||
|
qzole
|
One important information that I forgot to mention.
I'm using SDL version 2.0.3 |
|||||||||||
|
dependency on mingw32 lib on MinGW w64 build environment |
Dmitry Marakasov
Guest
|
* Nathaniel J Fries wrote:
There's not SDL2pp problem. For instance, FindSDL (for SDL 1.2) module bundled with CMake does add -lmingw32 explicitly. Also, sdl-config also lists this library for some reason. I'd really like to know why it's needed. -- Dmitry Marakasov . 55B5 0596 FF1E 8D84 5F56 9510 D35A 80DD F9D2 F77D ..: jabber: http://amdmi3.ru _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|