如何在另一台计算机上玩 SFML 游戏

编程入门 行业动态 更新时间:2024-10-23 10:26:52
本文介绍了如何在另一台计算机上玩 SFML 游戏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我为此搜索了很多,但似乎找不到真正能胜任这项工作的答案.我希望能够在我自己的计算机以外的其他计算机上使用 C++ 和 SFML 玩我的游戏.我试图简单地复制 .exe 文件和图像,但是当我这样做时,我只会收到关于缺少 .dll 文件的错误.我在 SFML 论坛上看到其他人这样做,所以一定有可能......我使用 Microsoft Visual C++ 2010.

I've been searching a lot for this, but can't seem to find an answer who really does the job. I want to able to play my game, using C++ with SFML, on other computers than my own. I've tried to simply copy the .exe file and the images over, but I just get errors about missing .dll files when I do that. I've seen other people on the SFML forums do this, so it must be possible somehow... I use Microsoft Visual C++ 2010.

推荐答案

如果您计划部署 SFML 应用程序,建议静态构建您的项目.这还需要静态构建 SFML.设置需要一点时间,但所有依赖项都将包含在您的可执行文件中,从而使您的应用程序更加可靠且易于安装.不要将此过程与静态链接到 SFML 混淆,在静态构建 SFML 后,您仍然需要这样做.

If you're planning on deploying an SFML application, statically building your project is recommended. This requires also statically building SFML. It takes a little time to setup, but all dependencies will be included in your executable making your application much more reliable and easier to install. This process is not to be confused with statically linking to SFML, which you will still need to do once you've statically build SFML.

您必须克隆 SFML 存储库 并使用 CMake 生成您的 Visual Studio 项目,然后您可以使用/MTd 静态构建 SFML调试和/MT 发布.这些选项可以在 Project Properties > 中找到.C/C++ >代码生成运行时库.

You will have to clone the SFML repository and use CMake to generate your visual studio project that will then let you build SFML statically with /MTd for debug and /MT for release. These options can be found in Project Properties > C/C++ > Code Generation > Runtime Library.

更多推荐

如何在另一台计算机上玩 SFML 游戏

本文发布于:2023-11-14 09:19:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1586825.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:机上   另一台   如何在   游戏   SFML

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!