有兩個工程都是從老版本的VC項目轉過來的,我目前適用的是VS2008(VC9), 編譯鏈接一切正常,但最后運行就報錯,說裝載C運行時庫出問題。
試了一些方法都不行,最后在stdafx.h中加了下面一句代碼就可以了:
#pragma comment(linker, "\"/manifestdependency:type='Win32' name='Microsoft.VC90.CRT' version='9.0.30729.1' processorArchitecture='X86' publicKeyToken='1fc8b3b9a1e18e3b' language='*'\"")
我的是VC9,版本是:9.0.30729.1(可以在About)里面看到。
這個鏈接里面也有一些說明。
http://www.shnenglu.com/deercoder/articles/101006.html