如何在另一台计算机上玩 SFML 游戏 [英] How to play a SFML game on another computer

查看:94
本文介绍了如何在另一台计算机上玩 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 游戏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆