研究了下,搞懂原理了。是VS 2015 編譯的問題,因為我是Win 10 ,所以會用到win 10 的SDK ,這個SDK 依賴了Universal C Runtime ,就是API-MS-CRT-XXX.dll系列,這個玩意兒是為了讓在Win 10 上用VS 2015 編譯出來的東西在早期Win 上運行完美的組件,所以dependency walker依賴那里有個DLL 的轉發。所以為啥我以前用VS 2012 在Win 10 開發,放Win 7上完美運行,而VS 2015 就不行,放Win 7 上就掛了。
其實VS2015 的Visual C++ Redistributable for Visual Studio 2015里面就包含了Universal C CRT。但是在非Win7 SP1上會安裝失敗,這是沒辦法的。
所以解決辦法有以下:
1.換低版本的VS2013來編譯項目
2.還是繼續用VS2015,不過運行時庫得用靜態鏈接,也就是說,你所有第三方用的依賴庫,都得重新用VS2015的運行時靜態連接編譯一遍,如果你用Qt,得了,Qt不提供靜態庫版本,得自己重新用VS2015編。
references:
https://www.zhihu.com/question/47973373
http://www.mamicode.com/info-detail-1488335.html
https://www.smartftp.com/support/kb/the-program-cant-start-because-api-ms-win-crt-runtime-l1-1-0dll-is-missing-f2702.html
https://support.microsoft.com/en-us/help/2999226/update-for-universal-c-runtime-in-windows
https://social.msdn.microsoft.com/Forums/en-US/96a1451b-ae6a-4c81-8029-dc00ab6a8d4a/the-program-cant-start-because-apimswincrtruntimel110dll-is-missing-from-your-computer?forum=vcgeneral