問題描述
我剛剛用 C++ 開發(fā)了我的第一個(gè)程序,我想和我的一個(gè)朋友展示它.可悲的是,當(dāng)他嘗試打開 exe 時(shí),它??收到一條錯(cuò)誤消息,顯示MSVCP140.dll 丟失".為什么會(huì)出現(xiàn)這個(gè)問題,他/我該如何解決?
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?
推薦答案
要么讓你的朋友下載運(yùn)行時(shí) 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選項(xiàng)卡->屬性 - >配置屬性 ->C/C++ ->運(yùn)行時(shí)庫的代碼生成
選擇/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ùn)行時(shí)嵌入到應(yīng)用程序中.可執(zhí)行文件會(huì)大很多,但無需任何運(yùn)行時(shí) dll 即可運(yùn)行.
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 丟失的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!