如何使用Visual Studio Express 2005完全静态链接的.exe? [英] How do I make a fully statically linked .exe with Visual Studio Express 2005?

查看:126
本文介绍了如何使用Visual Studio Express 2005完全静态链接的.exe?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前的首选C ++环境是免费的,并且在很大程度上是优秀的Microsoft Visual Studio 2005 Express版本。我不时地发送.exe文件给其他人喜欢的结果。然而,最近我做了令人不安的发现,令人愉快的结果是基于更多的运气,我想。试图在一个旧的(2001年份,不严格更新)XP盒子上运行这些程序之一给我什么,但一个讨厌的系统无法运行x.exe(或类似的)消息。

My current preferred C++ environment is the free and largely excellent Microsoft Visual Studio 2005 Express edition. From time to time I have sent release .exe files to other people with pleasing results. However recently I made the disturbing discovery that the pleasing results were based on more luck that I would like. Attempting to run one of these programs on an old (2001 vintage, not scrupulously updated) XP box gave me nothing but a nasty "System cannot run x.exe" (or similar) message.

一些googling显示,使用这个工具集,甚至指定静态链接导致一个简单的hello-world.exe实际上依赖于额外的.dll文件(msvcm80.dll等)。一个令人难以置信的精致的版本计划系统(清单文件任何人?)然后将不会让.exe运行没有完全正确的.dll版本。我不想要或需要这个东西,我只想要一个老式的自包含的.exe,只做最低的共同的Win32操作,并在任何旧的win32操作系统上运行。

Some googling revealed that with this toolset, even specifying static linking results in a simple hello-world.exe actually relying on extra .dll files (msvcm80.dll etc.). An incredibly elaborate version scheming system (manifest files anyone?) then will not let the .exe run without exactly the right .dll versions. I don't want or need this stuff, I just want an old fashioned self contained .exe that does nothing but lowest common denominator Win32 operations and runs on any old win32 OS.

有人知道是否可以做我想用现有的工具集做的事情。

Does anyone know if its possible to do what I want to do with my existing toolset ?

谢谢。

解决方案

对于C运行时转到项目设置,选择C / C ++然后选择'代码生成'。将'runtime library'设置改为'multithreaded'而不是'multithreaded dll'。

For the C-runtime go to the project settings, choose C/C++ then 'Code Generation'. Change the 'runtime library' setting to 'multithreaded' instead of 'multithreaded dll'.

如果你使用任何其他库,你可能需要告诉链接器忽略动态链接CRT。

If you are using any other libraries you may need to tell the linker to ignore the dynamically linked CRT explicitly.

这篇关于如何使用Visual Studio Express 2005完全静态链接的.exe?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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