Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am having trouble running my game. It works fine when I run it from Visual C++, but when I try to open the .exe, it complains that it can't find SDL.dll.

What should I do in order to play the game?

share|improve this question
Is the SDL.dll in the same directory as the executable? – Milkboat Apr 17 '12 at 1:39
If you are using Total Commander, you can download extension FileInfo. It will provide you list of all DLL's, which your application need and which are both found and missing. – zacharmarz Apr 17 '12 at 5:15
up vote 5 down vote accepted

IIRC Visual Studio uses a different current directory than the executable.

To fix, include SDL.dll in the same directory as your .exe file, along with anything else you may need. A symlink for this is a good fix, although I think there's also a setting in VS to choose the path.

share|improve this answer
for release, its way better to just copy the dll +1 – Gustavo Maciel Apr 17 '12 at 23:03

Find the path to the SDL.dll you're using, let's say it's C:\Path_To_DLL.

Possibly, you've added this path in some VC++ directories dialog. So Visual Studio tweaks your PATH environment variable before you run the game through it.

Or you've set the working directory for debugging your project to this path: by default all DLLs in the working directory can be loaded.

You've got several solutions:

  • As Pubby described, copy SDL.dll or symlink to it in the directory from which you're running your game "externally".

  • Start your game from a batch file where you add this path yourself to your path environment variable:

    set PATH=%PATH%;"C:\Path_To_DLL"
    start MyGame.exe
  • Add this path to your global environment variables, in Windows 7 look for "environment variables" in the Windows menu. Then you can just launch your game normally.

share|improve this answer

Also, consider the possibility of use a installer project offered by Visual Studio. Easy to use and gives you all the necessary stuff to install your games in every MS platform.

share|improve this answer

Just make sure Visual Studio is set up to run and debug the executable from the directory it is in, and make sure the SDL.dll is also in that directory.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.