I tried latest SDL release (SDL 2.28.4 at the time of writing) but according to the build enviroment (Dev-C++, RedPanda-Dev-C++, and Red Panda C++) I had different error messages…
I wonder if I am using 32/64 bit version of SDL2/MiniGW suite or if there are some specific version that I should use.
It seems that SDL 2.28.4 has reference to build release enviroment because I get reference to /Users/valve/release/ as you can see from the logs ‘C:/Program Files (x86)/Dev-Cpp/MinGW64/bin/…/lib/gcc/x86_64-w64-mingw32/10.3.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: C:\Users\stefy\Desktop\SDL2-2.28.4\x86_64-w64-mingw32\lib\libSDL2.a(SDL_windowsevents.o): in function `WIN_WindowProc’:
/Users/valve/release/SDL2/SDL2-2.28.4-source/foo-x64/…/src/video/windows/SDL_windowsevents.c:1311: ’ is ti correct?
Following the code and the command line used…
Most common issue - RedPanda-Dev-C++ I get
C:/Program Files (x86)/Dev-Cpp/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\stefy\Desktop\SDL2-2.28.4\x86_64-w64-mingw32\lib\libSDL2.a(SDL_hidapi.o): in function `PLATFORM_hid_enumerate':
/Users/valve/release/SDL2/SDL2-2.28.4-source/foo-x64/../src/hidapi/windows/hid.c:388: undefined reference to `__imp_SetupDiGetClassDevsA'
I got it run with a “fresh installed” Dev-C++ 188.8.131.52 and mingw64 12.2.0.
Binaries: Set a path to the bin directory of mingw64
Libraries: Set a path to the lib directory of mingw64
Set a second path to …/SDL2-2.28.4/x86_64-w64-mingw32/lib
C includes: Set a path to mingw64/include
Set a second path to …/SDL2-2.28.4\x86_64-w64-mingw32\include
Tools->Compiler Options-> “Add these commands to the linker command line”
Activate the checkbox and set the following commands:
That’s CoInitializeEx from Ole32 (-lOle32). You can find corresponding libraries from your error messages: undefined reference to __imp_CoInitializeEx ==> CoInitializeEx ==> Search | Microsoft Learn ==> Library Ole32.lib
Anyways, it’s strange that your gcc miss link to default libs, the gcc from MSYS2 does not have such problem, maybe you got tweaked/outdated compiler?
It seems that the issue is that I’m using a “static-version” (see: SDL2 linking issue ) of SDL2 thus I have to provides ALL the libraries to the linker. At the moment i can compile by using the following linker options
No, the sdl2-config is not a configure, it’s a script used to get installed SDL2’s cflags and/or libs.
You can avoid manual dependency management by using this script in your Makefile. Also the target SDL2::SDL2-static from CMake SDL package will work too.