Visual Studio 2010 C++ SDL 游戏可以在编译它的计算机上运行,​​但不能在任何其他计算机上运行

发布于 2024-12-05 12:15:33 字数 886 浏览 1 评论 0原文

我使用 SDL 和 Visual Studio 2010 在 C++ 中编写了一个圈和十字游戏。我已经在 Release 中构建了它,如果我在编译它的计算机(Windows 7 64 位 Home Premium)上运行 .exe,它就可以正常工作。

我尝试在我的笔记本电脑(Windows 7 x86 Home premium)上运行它,它打开一个 SDL 窗口并立即关闭。我发现它在加载特定文件时崩溃,因此在初始化代码中添加了控制台输出,结果发现它找不到这个文件:

if((menuSurface = Surface::Load("gfx/menu.png")) == NULL){
        std::cout << "menu Did not load.";
        system("pause");
        return false;
    }

奇怪的是,这是加载的第二个文件,原始计算机可以很好地找到它。

上述问题已解决!我只是忘记添加 sdl_image 附带的额外 .dll 文件,例如 zlib1.dll、libpng12-0.dll 等...第二个问题仍然存在。

另外,在我朋友的计算机上运行它时,它会出现此错误

TestWin32.exe – 系统错误

程序无法启动,因为您的 MSVCR100.dll 丢失 *电脑。尝试重新安装程序来解决此问题。*

我将 MSVCR100.dll 文件包含在与 .exe 相同的文件夹中(以及 SDl.dll 和 SDL_image.dll),但仍然没有任何乐趣。该文件存在于他的 SysWOW64 文件夹中,但程序没有拾取它。谁能看出可能是什么原因造成的?

I have coded a game of noughts and crosses in C++ using SDL and Visual Studio 2010. I have built it in Release and it works no problem if I run the .exe on the computer I compiled it on (Windows 7 64bit Home Premium).

I tried to run it on my laptop (Windows 7 x86 Home premium) and it opens up an SDL window and immediately closes. I found it was crashing when loading a particular file so added a console output to the initialisation code and turns out it is this file it can't find:

if((menuSurface = Surface::Load("gfx/menu.png")) == NULL){
        std::cout << "menu Did not load.";
        system("pause");
        return false;
    }

Peculiarly this is the second file loaded and the original computer can find it fine.

Problem above has been solved! I simply forgot to add the extra .dll files that came with sdl_image such as zlib1.dll, libpng12-0.dll etc... Second problem still persists.

Additionally on my friends computer when I run it, it comes up with this error

TestWin32.exe – System Error

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

I included the MSVCR100.dll file in the same folder as the .exe (along with the SDl.dll and SDL_image.dll) and still no joy. The file is present in his SysWOW64 folder but the program isn't picking it up. Can anyone see what may be causing this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

美人迟暮 2024-12-12 12:15:33

第一个问题可能是资源不在正确位置的问题。

第二个问题是,对于新的 Microsoft C 运行时 DLL,您不能仅仅包含它,您需要为 Visual Studio 2010 部署适当的可再发行组件。

您可以发现 (x86) com/download/en/details.aspx?id=5555" rel="nofollow">此处。 如果您需要,还有一个单独的 x64 版本。

The first problem is likely an issue with the resource not being at the correct location.

The second problem is that with the new Microsoft C runtime DLLs you cannot just include it, you need to deploy the appropriate redistributable for Visual Studio 2010.

You can find that (x86) here. There is also a separate x64 version if you need it.

望她远 2024-12-12 12:15:33

这可能是识别您忘记随程序附带哪些库的最有用的工具:

它最初是包含在 Windows SDK 中,但该网站已更新版本。

This is probably the most helpful tool for identifying which libraries you forgot to ship with your program:

It was originally included with the Windows SDK, but that website has updated versions.

英雄似剑 2024-12-12 12:15:33

在目标计算机上安装 microsoft vc++ redist,尝试复制 msvcr100.dll/msvcp100.dll 时也遇到了麻烦。

install microsoft vc++ redist on target machine, have had trouble just trying to copy msvcr100.dll/msvcp100.dll too.

渔村楼浪 2024-12-12 12:15:33

找出您的可执行文件在您的开发系统以及其他系统上动态加载的 DLL。

我怀疑某些不应该加载的 DLL 正在加载,例如库的 DLL 版本错误。

Find out what DLLs your executable is dynamically loading, both on your development system as well as on the other systems.

I suspect that some DLL is being loaded that shouldn't be, e.g. a library's DLL in a wrong version.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文