- I installed the following Cygwin 64 packages (I'm not sure if they are all necessary)
- Download the MinGW SDL2 development files.
- Extract the SDL2 development files.
- Copy source to dest (using SDL2-2.0.1 as the example)
- Edit C:\cygwin64\bin\sdl2-config
- Change the "prefix" variable to /usr/x86_64-w64-mingw32/sys-root/mingw
- Remove "-XCClinker" from the linker line.
- Compile and link (statically)
- x86_64-w64-mingw32-gcc.exe opengltest.c -o gltest.exe $(sdl2-config --cflags --static-libs) -lopengl32
Friday, January 24, 2014
Using Cygwin and the MinGW Cross Compiler with SDL2
MinGW is currently the most popular way to use GCC on Windows. I recently found that there is a way of using MinGW from within Cygwin as a cross-compiler. I've recently been doing some OpenGL programming across both Linux and Windows, and using Cygwin has allowed me to keep my build system largely the same.