Trying to write a C program using the SDL2 library on Windows 11 - zero compiler errors, but still cannot execute the compiled program.
On my system I've installed the MINGW32 GCC compiler, compiling and running a "hello world" is no problem. The SDL2 version I downloaded is the mingw32-devel variant.
In my SDL2 project I've copied over the include and lib folder from the i686 version of SDL2, as well as the respective .dll file. Project structure:
.
| src
| include
| lib
| SDL2.dll
| Makefile
| sdl_test.c
The .c file compiles fine on Linux. It only opens a window and waits for a quit signal.
As you can see below, compiling produces no warnings or errors on Windows, but fails to run:
PS C:\Users\eiriken\Documents\sdl-test> make
gcc -Wall -Isrc/include -Lsrc/lib sdl-test.c -lmingw32 -lSDL2main -lSDL2 -o out.exe
PS C:\Users\eiriken\Documents\sdl-test> .\out.exe
Program 'out.exe' failed to run: The specified executable is not a valid application for this OS platform.At line:1 char:1
+ .\out.exe
+ ~~~~~~~~~.
At line:1 char:1
+ .\out.exe
+ ~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException
+ FullyQualifiedErrorId : NativeCommandFailed
What am I doing wrong, except for trying to develop code on a Windows platform?