Getting and Installing SDL
The SDL package can be put on your home computer:
To avoid setting some Project Properties for every new SDL project in
Visual Studio, follow these steps:
- The following location is where you can get SDL:
The Package is under the "Development Libraries" called:
SDL-devel-1.2.14-VC8.zip (Visual C++ 2005 Service Pack 1)
I recommend extracting the package to a directory called SDL-1.2.14
(perhaps in the Program Files folder ie.C:\Program Files\SDL-1.2.14\)
If you want to use SDL on a computer where you are not an admin and it is not already installed:
- Make a directory under C:\Program Files\Microsoft Visual Studio 9.0\VC\include called SDL
- Transfer all of the .h files from the SDL-1.2.14\include directory into this newly created SDL directory.
- Copy SDL-1.2.14\lib\SDL.dll to C:\WINDOWS\System
- Copy SDLmain.lib and SDL.lib (also in SDL-1.2.14\lib\) to C:\Program Files\Microsoft Visual Studio 9.0\VC\lib
- Make a directory in your project folder called SDL.
- Transfer all of the .h files from the SDL-1.2.14\include\
directory into this newly created SDL directory.
- Copy SDL-1.2.14\lib\SDL.dll to you project folder
- Make a directory in your project folder called lib.
- Copy SDLmain.lib and SDL.lib (also in SDL-1.2.14\lib\) into that lib folder.
Setting up a SDL project with Visual Studio
If you installed SDL by following the above directions:
- In Visual Studio, create a new project.
- Under "Visual C++ Projects", select 'Win32 Project' under the 'Win32' folder. Choose a 'Name' and 'Location'
- At the Application Wizard. Click on the 'Application Settings', select 'Empty project'
- Click on 'Finish'.
- Save the 'main.cpp' code into the project directory
For new projects, you can start from this SDL template.
- Right-click on the "Source Files" in the solution tree, and select 'Add Existing Item...'
- Select 'main.cpp', and click 'Open'.
- We can now make some changes to the properties. Under the 'Project' Menu, select
- Under the 'Linker' folder in the 'Input' category, add "SDLmain.lib sdl.lib opengl32.lib glu32.lib" (without quotes) in the "Additional Dependencies" field.
- If you added SDL to your project folder rather than the system wide location:
- Under the 'Linker' folder in the 'General' category add "./lib/" in the "Additional Library Directories" field.
- Under the 'C/C++' folder in the 'General category add "." in the "Additional Include Directories" field.
- Click 'OK' to accept the changes