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?
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It only takes a minute to sign up.Sign up to join this community
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.
Find the path to the SDL.dll you're using, let's say it's
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:
RunMyGame.bat: 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.