1.中文乱码问题:
在资源视图中,右击对话框IDD,选择属性,将语言更改为Chinese (Simplified, PRC)即可。
或者在新建工程时,资源语言选择中文:
2.编译报错,需要编译两次才可以通过。
Project--->xxx Property Pages--->Configuration Properties--->Linker中的Enable Incremental Linking属性改为Default。
3.字符集问题导致编译报错:error C2664: 'strcpy' : cannot convert parameter 2 from 'wchar_t *' to 'const char *'。
Project--->xxx Property Pages--->Configuration Properties中的Character Set配置为Not Set即可。
4.编译为静态库。
Project--->xxx Property Pages--->Configuration Properties中的Use of MFC配置为Use MFC in a Static Library。
或者在新建工程时,选择为静态库即可:
5.改变字符集导致界面变为VC风格。
将文件stdafx.h中的最后关于UNICODE码的宏注释掉即可。
//#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#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='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
//#endif
6.使用fopen函数时,编译产生警告:
warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
解决方法:Project--->xxx Property Pages--->Configuration Properties--->C/C++--->Preprocessor--->Preprocessor Definitions添加_CRT_SECURE_NO_WARNINGS即可。