This document describes how to install SDL v2 on MS-Windows for use with MinGW. It assumes that you have already installed MinGW.
Then you need to extract everything from the compressed archive. (If you
have installed MSYS you can use gunzip
and tar
.
If not, you should install the GNU utilities for Windows available from the
"Unix-like Utilities page".)
.a
files from the appropriate lib
directory to
the MinGW\lib
directory (the exact location of which will
vary depending on where you installed MinGW
).
SDL
directory from the appropriate include
directory to
the MinGW\include
directory (the exact location of which will
vary depending on where you installed MinGW
).
SDL2.dll
from the appropriate bin
directory
to the directory where your executable will be created.
SDL2.dll
in any directory in
your path. However, this may cause version conflicts if you have
installed any applications that use SDL. So, it's safer though less
elegant to just put SDL2.dll
in the same directory
as your executable.)
#include "SDL2/SDL.h"
so that the compiler
will recognize the SDL function data types and function calls.
SDL2main.a
and
SDL2.a
using -lSDL2main
and
-lSDL2
test.c
)
to test your installation:
You should be able to build this program from the command line as follows:
g++ -o test.exe test.c -lmingw32 -lSDL2main -lSDL2
In jGrasp, choose Settings on the main menu, pull down to Compiler Settings, and then pull down to either Workspace or Project. Next, click on the Compiler tab and change the "Language" to C.
From here, you can set the "FLAGS or ARGS" for "Make", the "Compiler", etc... See, for example, the flags and arguments used in the example above.
Copyright 2019