問題描述
我目前首選的 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?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!