如何使用 Visual Studio Express 2005 制作完全静态链接的 .exe?

How do I make a fully statically linked .exe with Visual Studio Express 2005?(如何使用 Visual Studio Express 2005 制作完全静态链接的 .exe?)
本文介绍了如何使用 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.

一些谷歌搜索显示,使用此工具集,即使在简单的 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++,然后选择代码生成".将运行时库"设置更改为多线程"而不是多线程 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Returning a pointer of a local variable C++(返回局部变量 C++ 的指针)
Inline function linkage(内联函数联动)
Which is more efficient: Return a value vs. Pass by reference?(哪个更有效:返回值与通过引用传递?)
Why is std::function not equality comparable?(为什么 std::function 不具有可比性?)
C++ overload resolution(C++ 重载解析)
When to Overload the Comma Operator?(什么时候重载逗号运算符?)