問題描述
我剛剛用 C++ 開發(fā)了我的第一個程序,我想和我的一個朋友展示它.可悲的是,當(dāng)他嘗試打開 exe 時,它??收到一條錯誤消息,顯示MSVCP140.dll 丟失".為什么會出現(xiàn)這個問題,他/我該如何解決?
I just developed my first program in C++ and I wanted to show it with one of my friends. Sadly, when he tries to open the exe it gets an error which says "MSVCP140.dll is missing". Why is this issue happening and how can he/I fix it?
推薦答案
要么讓你的朋友下載運行時 DLL(@Kay 的回答),要么用靜態(tài)鏈接編譯應(yīng)用程序.
Either make your friends download the runtime DLL (@Kay's answer), or compile the app with static linking.
在visual studio中,轉(zhuǎn)到Project選項卡->屬性 - >配置屬性 ->C/C++ ->運行時庫的代碼生成
選擇/MTd
為調(diào)試模式,/MT
為發(fā)布模式.
In visual studio, go to Project tab -> properties - > configuration properties -> C/C++ -> Code Generation
on runtime library choose /MTd
for debug mode and /MT
for release mode.
這將導(dǎo)致編譯器將運行時嵌入到應(yīng)用程序中.可執(zhí)行文件會大很多,但無需任何運行時 dll 即可運行.
This will cause the compiler to embed the runtime into the app. The executable will be significantly bigger, but it will run without any need of runtime dlls.
這篇關(guān)于MSVCP140.dll 丟失的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!