使用WTL时出现CString 重复定义的问题

解决办法:在 stdafx.h 中的 #include <atlmisc.h> 前加上加上如下代码

#define _WTL_NO_CSTRING
#inlcude <atlstr.h>
#include <atlmisc.h>

因为 atlstr.h 和 atlmisc.h 中都定义了CString类,同时包含这两个头文件时会出现CString定义不明确的错误。当然,也可以在定义变量时用域名区分,如下

WTL::CString wtlstr;
ATL::CString atlstr;

 

posted @ 2014-01-24 17:26  琼'  阅读(350)  评论(0)    收藏  举报