Home > front end >  SDL2.dll was not found
SDL2.dll was not found

Time:03-05

I'm trying to set up SDL2 in C Visual Studio but when I run the code(just some starter code I copied) it pops up with an error box box that talks about "SDL2.dll cannot be found" I tried switching to x64 but that was no help. I can see that the dll is right next to the lib files but it just won't work.

CodePudding user response:

Your problem is the lib folder is not a place that your OS will search for dependent dlls by default. To fix this you would have to help your OS find the dll. There are several methods you can use to tell your OS where to look. One is adding an entry to your PATH environment variable that contains the full path to the folder containing the dll.

This site can help with setting the PATH: https://www.computerhope.com/issues/ch000549.htm

As second method is to put the dll in the same folder as the executable.

By default your OS probably is using the safe search option described here:


  1. The directory from which the application loaded.

  2. The system directory. Use the GetSystemDirectory function to get the path of this directory.

  3. The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched.

  4. The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.

  5. The current directory.

  6. The directories that are listed in the PATH environment variable. Note that this does not include the per-application path specified by the App Paths registry key. The App Paths key is not used when computing the DLL search path.***

  • Related