之前系统设置的时间、日期、语速语调设置三个程序改成release版后在机器上不能打开,原因在于
1、release版本中系统采用静态链接方式调用MFC库,即在系统设置中Microsoft Fondation Classes一项应选择Use MFC in a Static Library。
2、系统画图时用到的一个方法pImagingFactory,该方法需要调用链接一个静态库Ole32.lib,在release版本中必须显示调用,即#pragma comment (lib,"Ole32.lib"),如果不加这个语句会报错error LNK2019: unresolved external symbol CoCreateInstance referenced in function "protected: virtual int __cdecl CSun_timeSystemDlg::OnInitDialog(void)" (?OnInitDialog@CSun_timeSystemDlg@@MAAHXZ),在setting->C/C++->Preprocessor definitions中加入_AFXDLL也可以编译通过,并且可以在模拟器上运行,但是不能在机器上运行。而加上#pragma语句,就可以从根本上解决问题,程序可以在机器上运行。