为vc工程添加Unicode Debug和Unicode Release
通过使用unicode编译,软件可以适应多种情况,如何在自己的工程中添加这两种编译方式呢?下面是一个简单的步骤
1、新建一个工程;
2、选择“Build->Configurations”菜单
3、点击“Add”按钮,添加“Unicode Debug”-拷贝“win32 Debug”配置
添加“Unicode Release”-拷贝“win32 Release”配置 ,然后点击“OK”
4、选择“Project->Setting”菜单
5、切换到“General ”TAB页
6、修改“Win32 Unicode Debug”的Intermediate Files和Output Files为DebugU
7、修改“Win32 Unicode Release”的Intermediate Files和Output Files为ReleaseU
8、切换到“C++ ”Tab页
9、从下拉列表框中选择“Preprocessor”
10、为“Win32 Unicode Debug”和“Win32 Unicode Release”分别添加_UNICODE(和UNICODE)
11、 切换到“Link ”Tab页
12、选择Output, 再在Entry-point symbol中填入wWinMainCRTStartup, 即可(dll工程的入口DllMain不需要修改这一项)
(
这步很重要, 要不然,你编译的时候会报错。
程序入口设置错误, 提示:
msvcrtd.lib(crtexew.obj) : error LNK2001: unresolved external symbol _WinMain@16
通常, MFC项目的程序入口函数是WinMain, 如果编译项目的Unicode版本,程序入口必须改为
wWinMainCRTStartup
)