Set up SDL in Visual Studio 2012 on Windows 8

I have successfully made SDL(Simple DirectMedia Layer) working in Microsoft Visual Studio 2012 on my new 64-bit Windows 8 laptop. In the beiginning I did encountered some problems but solved it soon. In this article, I will describe how I did it step by step.

1. Create a new project

– Create a new project called VC++SdlSample
– Add a new C++ file called Main.cpp
– Write following basic code in the Main.cpp file:

#include "SDL.h"

int main( int argc, char* args[] )
    //Start SDL

    //Quit SDL

    return 0;

2. Download SDL library

– Go to:
– Go to Development Libraries section -> Win32, find (Visual C++) and download it.
– After uncompressing, you will get the folder called SDL-1.2.15. Then put it somewhere you like.

3. Deploy SDL and configration

Here we come to the most important step.
– Go to SDL-1.2.15 folder, under its lib directory, you will find two folders called x64 and x86. Basically, x64 is for 64 bit platform while x86 is for 32bit platform. The 32bit programs can run both platforms while 64bit programes can only run on 64 bit platform.
– Go to the x86 directory, copy SDL.dll file and put it into C:WindowsSysWOW64 directory.
– Go to Visual Studio, right click on the project, go to Properties
– Go to VC++ Directories:
1)  Add my SDL-1.2.15/include directory to Include Directories:
2)  Add my SDL-1.2.15/lib/x86 directory to Library Directories:

– Go to Linker -> Input, Add SDL.lib and SDLmain.lib to Additional Dependencies. Like following screenshot:
-4) Go to Linker -> System -> SubSystem, choose Windows(/SUBSYSTEM:WINDOWS)
– Go to C/C++ -> Code Generation -> Runtime Library, choose Multi-thread DLL(/MD)
– Save all the setting and exit.

4. Run the test program to make sure it works.

5. Other

– I got stuck first time when I used x64 SDL.dll. I thought it should work because I am on 64 bit Windows 8 system. But it didn’t work (always get the “application was unable to start correctly 0xc000007b”) and I don’t know why.

– Installing other SDL libraries such as SDL_Image.lib is similar.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s