应用程序仅在64位版本上出错

时间:2017-03-30 13:23:30

标签: visual-c++ mfc 64-bit

如果是32位版本,我的应用程序运行良好,但当我将新的64位平台添加到配置管理器并尝试运行它时,我在启动时收到以下消息:

enter image description here

1 个答案:

答案 0 :(得分:0)

阅读64bit manifest problem / side by side issue后,我得出结论,问题是清单行

#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")

所以我添加到分支,由平台条件:

#ifdef _WIN64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif

所以,我添加将它变为通用的,独立于平台:

#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")

请注意 processorArchitecture 值的差异。

现在一切正常!