如何使单个可执行文件与2010年 [英] How to make a Single Executable VS 2010

查看:126
本文介绍了如何使单个可执行文件与2010年的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用C ++和DirectX制作游戏,通过提供单个可执行文件而不是运行安装向导,与其他人共享我的组进度是很好的。

I'm making a game using C++ and DirectX and it'd be nice to share my groups progress with other people by providing a single executable file instead of having to run a setup wizard.

我已经检查了我的发布和调试文件夹,但这些可执行文件不工作。发布.exe是一个像21KB这似乎不对。

I've checked my Release and Debug folders but those executable don't work. The release .exe is something like 21KB which doesn't seem right.

所以我想我要求是如何使一个单一的可执行文件与所有的库和资源文件。

So I guess what I'm asking is how to make a single executable with all of the libraries and resource files included.

推荐答案

您需要指定所有的库必须静态链接。在Visual Studio中这样做:

You need to specify that all your libraries have to be statically linked in. There are several threads about doing this in Visual Studio, like:

但是,要添加到这些链接的答案,请注意:

However, to add on to those answers linked, be aware that:


  • 您必须具有实际的静态库才能链接。在许多情况下,Windows中的 .lib 文件是链接到DLL的存根库。

  • 也许不是你需要的一切静态链接可以是(即,你不会找到它的静态链接库)

  • 您不必将您的二进制文件作为完全静态链接的可执行文件。您可以将所有相关库放在与可执行文件相同的目录中。这可以简化未来的共享,因为您只需更换一些库,而不必将整个文件发送给每个人。

  • You must have actual static libraries to link against. In many instances, .lib files in Windows land are stub libraries that link to the DLL.
  • Perhaps not everything you need to be statically linked can be (i.e. you will not find a static link library of it)
  • You don't have to distribute your binary as a completely statically linked executable. You can ship all the dependent libraries in the same directory as your executable. This could simplify future sharing as you'd only have to replace some libraries vs. sending the entire file to everyone.

这篇关于如何使单个可执行文件与2010年的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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