Using SDL with Microsoft Visual C++
by Lion Kimbro with additions by James Turk
You can either use the precompiled libraries from the SDL web site, or you can build SDL yourself.
Building SDL
-
To build SDL, your machine must, at a minimum, have the DirectX9.0c SDK installed. It may or may not be retrievable from the Microsoft website, so you might need to locate it online. Editor's note: I've been able to successfully build SDL using Visual Studio 2019 without the DX9.0c SDK
-
Open the Visual Studio solution file at
./VisualC/SDL.sln
. -
Your IDE will likely prompt you to upgrade this solution file to whatever later version of the IDE you're using. In the
Retarget Projects
dialog, all of the affected project files should be checked allowing you to use the latestWindows SDK Version
you have installed, along with thePlatform Toolset
.
If you choose NOT to upgrade to use the latest Windows SDK Version
or Platform Toolset
, then you'll need the Visual Studio 2010 Platform Toolset
.
- Build the
.dll
and.lib
files by right clicking on each project in turn (Projects are listed in the Workspace panel in the FileView tab), and selectingBuild
.
You may get a few warnings, but you should not get any errors.
Later, we will refer to the following .lib
and .dll
files that have just been generated:
-
./VisualC/Win32/Debug/SDL2.dll
or./VisualC/Win32/Release/SDL2.dll
-
./VisualC/Win32/Debug/SDL2.lib
or./VisualC/Win32/Release/SDL2.lib
-
./VisualC/Win32/Debug/SDL2main.lib
or./VisualC/Win32/Release/SDL2main.lib