C++ 我的电脑中缺少 SDL.dll - VS 2010

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12652136/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 16:28:24  来源:igfitidea点击:

SDL.dll is missing from my computer - VS 2010

c++visual-studio-2010sdl

提问by Nilzone-

I'm trying to compile a SDL-program I've written, but when I do, this error shows up:

我正在尝试编译我编写的 SDL 程序,但是当我这样做时,会出现此错误:

The program can't start because SDL.dll is missing from your computer. Try reinstalling the program to fix this problem

程序无法启动,因为您的计算机缺少 SDL.dll。尝试重新安装程序以解决此问题

I have no idea as to why. I have SDL.dll.

我不知道为什么。我有 SDL.dll。

  • I have put it in the correct folder: C:\Windows\System32.

  • I have the correct PATHS to all the SDL headers and such as well.

  • 我已经把它放在正确的文件夹中:C:\Windows\System32.

  • 我有所有 SDL 头文件的正确路径等等。

VS says:

VS 说:

Build succeeded: 1

构建成功:1

and THEN the error above pops up on screen.

然后屏幕上弹出上面的错误。

回答by Rapptz

Add it into your debug folder or whatever directory your program is currently located at.

将它添加到您的调试文件夹或您的程序当前所在的任何目录中。

回答by Elliot Hatch

IfSDL.dllis 32-bit and you're running a 64-bit system you have to place the dll into /Windows/SysWOW64/rather than /Windows/System32/, which is used for 64-bit dlls.

如果SDL.dll是 32 位并且您运行的是 64 位系统,则必须将 dll 放入/Windows/SysWOW64/而不是/Windows/System32/用于 64 位 dll 的 .

EDIT:
You probably shouldn't be deploying your DLLs by copying them into the System32 directory, unless they're common libraries that are used by several applications, and even then I would use discretion. For example, an application could update the DLL, which could break other applications that rely on an older version of the library.

编辑:
您可能不应该通过将 DLL 复制到 System32 目录来部署它们,除非它们是多个应用程序使用的公共库,即使这样我也会谨慎使用。例如,应用程序可以更新 DLL,这可能会破坏依赖于旧版本库的其他应用程序。

Instead, copy the DLLs into the same directory that the executable is being built in. If you're building and executing with Visual Studio it will look for the DLL in the Project directory, where your source files are probably located.

相反,将 DLL 复制到正在构建可执行文件的同一目录中。如果您使用 Visual Studio 构建和执行,它将在项目目录中查找 DLL,您的源文件可能位于该目录中。

回答by Luchian Grigore

SDL.dllhas to either be in the same directory as your application, or in a directory that's in the PATHenvironment variable.

SDL.dll必须与您的应用程序位于同一目录中,或者位于PATH环境变量中的目录中。

回答by hamon

Just place your SDL.dll in the same folder and your problem will be solved. And to answer to your problem with the PATH, you can specify in visual studio where he will look for executables while debugging. Maybe this isn't set correctly and that's why VS can't find SDL.dll?

只需将您的 SDL.dll 放在同一文件夹中,您的问题就会得到解决。为了回答您的 PATH 问题,您可以在 Visual Studio 中指定调试时他将在哪里查找可执行文件。也许这设置不正确,这就是为什么 VS 找不到 SDL.dll?