MFC、 ATL、WTL中Cstring的兼容
个人编程习惯,总喜欢将一块功能实现之后,复制一个副本。但是,最近遇到一个问题,eg:一个项目文件夹的名字为“CallCenter - 副本”,打开此项目编译是完全可以编译通过正常运行的,如果更改文件夹名字为“CallCenter ”时,vs2005编译时出现以下错误:
-------------------------------------------------错误输出-----------------------------
fatal error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]
-------------------------------------------------错误输出-----------------------------
根据网上搜索,做了一些尝试:在项目属性中,“MFC的使用” 将“使用windows标准库”修改为“在共享DLL中使用MFC”,但是出现了以下错误:
-------------------------------------------------错误输出-----------------------------
e:\vs2005\vc\atlmfc\include\wtl80\atluser.h(404) : error C2039: “CString”: 不是“ATL”的成员
1> e:\vs2005\vc\atlmfc\include\wtl80\atluser.h(558): 参见对正在编译的类 模板 实例化“WTL::CMenuT<t_bManaged>”的引用
1>e:\vs2005\vc\atlmfc\include\wtl80\atlgdi.h(2604) : error C2039: “CString”: 不是“ATL”的成员
1> e:\vs2005\vc\atlmfc\include\wtl80\atlgdi.h(3315): 参见对正在编译的类 模板 实例化“WTL::CDCT<t_bManaged>”的引用
1>e:\vs2005\vc\atlmfc\include\wtl80\atlgdi.h(2604) : error C2039: “CString”: 不是“ATL”的成员
1> e:\vs2005\vc\atlmfc\include\wtl80\atlgdi.h(3325): 参见对正在编译的类 模板 实例化“WTL::CDCT<t_bManaged>”的引用
1> with
1> [
1> t_bManaged=true
1> ]
1>e:\vs2005\vc\atlmfc\include\wtl80\atlctrls.h(626) : error C2039: “CString”: 不是“ATL”的成员
1> e:\vs2005\vc\atlmfc\include\wtl80\atlctrls.h(781): 参见对正在编译的类 模板 实例化“WTL::CListBoxT<TBase>”的引用
1>e:\vs2005\vc\atlmfc\include\wtl80\atlctrls.h(966) : error C2039: “CString”: 不是“ATL”的成员
1> e:\vs2005\vc\atlmfc\include\wtl80\atlctrls.h(1156): 参见对正在编译的类 模板 实例化“WTL::CComboBoxT<TBase>”的引用
1>e:\vs2005\vc\atlmfc\include\wtl80\atlctrls.h(1992) : error C3861: “ImageList_Read”: 找不到标识符
1>e:\vs2005\vc\atlmfc\include\wtl80\atlctrls.h(2099) : error C3861: “ImageList_Read”: 找不到标识符
1>e:\vs2005\vc\atlmfc\include\wtl80\atlctrls.h(2105) : error C3861: “ImageList_Write”: 找不到标识符
1>e:\vs2005\vc\atlmfc\include\wtl80\atlctrls.h(2112) : error C3861: “ImageList_ReadEx”: 找不到标识符
1>e:\vs2005\vc\atlmfc\include\wtl80\atlctrls.h(2118) : error C3861: “ImageList_WriteEx”: 找不到标识符
1>e:\vs2005\vc\atlmfc\include\wtl80\atlctrls.h(2935) : error C2039: “CString”: 不是“ATL”的成员
1> e:\vs2005\vc\atlmfc\include\wtl80\atlctrls.h(3933): 参见对正在编译的类 模板 实例化“WTL::CListViewCtrlT<TBase>”的引用
1>e:\vs2005\vc\atlmfc\include\wtl80\atlctrls.h(4079) : error C2039: “CString”: 不是“ATL”的成员
1> e:\vs2005\vc\atlmfc\include\wtl80\atlctrls.h(4632): 参见对正在编译的类 模板 实例化“WTL::CTreeViewCtrlT<TBase>”的引用
1>e:\vs2005\vc\atlmfc\include\wtl80\atlctrls.h(4682) : error C2039: “CString”: 不是“ATL”的成员
1> e:\vs2005\vc\atlmfc\include\wtl80\atlctrls.h(4749): 参见对正在编译的类 模板 实例化“WTL::CTreeItemT<TBase>”的引用
1>e:\vs2005\vc\atlmfc\include\wtl80\atlctrls.h(5057) : error C2039: “CString”: 不是“ATL”的成员
1>e:\vs2005\vc\atlmfc\include\wtl80\atlctrls.h(5730) : error C2039: “CString”: 不是“ATL”的成员
1> e:\vs2005\vc\atlmfc\include\wtl80\atlctrls.h(6007): 参见对正在编译的类 模板 实例化“WTL::CToolBarCtrlT<TBase>”的引用
1>e:\vs2005\vc\atlmfc\include\wtl80\atlctrls.h(6099) : error C2039: “CString”: 不是“ATL”的成员
1> e:\vs2005\vc\atlmfc\include\wtl80\atlctrls.h(6215): 参见对正在编译的类 模板 实例化“WTL::CStatusBarCtrlT<TBase>”的引用
1>e:\vs2005\vc\atlmfc\include\wtl80\atlctrls.h(7446) : error C2039: “CString”: 不是“ATL”的成员
1> e:\vs2005\vc\atlmfc\include\wtl80\atlctrls.h(8065): 参见对正在编译的类 模板 实例化“WTL::CRichEditCtrlT<TBase>”的引用
1>e:\vs2005\vc\atlmfc\include\wtl80\atlctrls.h(8870) : error C2039: “CString”: 不是“ATL”的成员
1> e:\vs2005\vc\atlmfc\include\wtl80\atlctrls.h(8946): 参见对正在编译的类 模板 实例化“WTL::CComboBoxExT<TBase>”的引用
1>e:\vs2005\vc\atlmfc\include\wtl80\atlctrls.h(966) : error C2039: “CString”: 不是“ATL”的成员
1> e:\vs2005\vc\atlmfc\include\wtl80\atlctrls.h(8905): 参见对正在编译的类 模板 实例化“WTL::CComboBoxT<TBase>”的引用
1> with
1> [
1> TBase=ATL::CWindow
1> ]
1>e:\vs2005\vc\atlmfc\include\wtl80\atldlgs.h(532) : error C2039: “CString”: 不是“ATL”的成员
1> e:\vs2005\vc\atlmfc\include\wtl80\atldlgs.h(863): 参见对正在编译的类 模板 实例化“WTL::CMultiFileDialogImpl<T>”的引用
1>e:\vs2005\vc\atlmfc\include\wtl80\atldlgs.h(624) : error C2039: “CString”: 不是“ATL”的成员
1>e:\vs2005\vc\atlmfc\include\wtl80\atldlgs.h(694) : error C2039: “CString”: 不是“ATL”的成员
1>e:\vs2005\vc\atlmfc\include\wtl80\atldlgs.h(532) : error C2039: “CString”: 不是“ATL”的成员
1> e:\vs2005\vc\atlmfc\include\wtl80\atldlgs.h(866): 参见对正在编译的类 模板 实例化“WTL::CMultiFileDialogImpl<T>”的引用
1> with
1> [
1> T=WTL::CMultiFileDialog
1> ]
1>e:\vs2005\vc\atlmfc\include\wtl80\atldlgs.h(624) : error C2039: “CString”: 不是“ATL”的成员
1>e:\vs2005\vc\atlmfc\include\wtl80\atldlgs.h(694) : error C2039: “CString”: 不是“ATL”的成员
1>e:\vs2005\vc\atlmfc\include\wtl80\atlmisc.h(3024) : error C2039: “CString”: 不是“ATL”的成员
1> e:\vs2005\vc\atlmfc\include\wtl80\atlmisc.h(3257): 参见对正在编译的类 模板 实例化“WTL::CRecentDocumentListBase<T,t_cchItemLen,t_nFirstID,t_nLastID>”的引用
1>e:\vs2005\vc\atlmfc\include\wtl80\atlmisc.h(3024) : error C2039: “CString”: 不是“ATL”的成员
1> e:\vs2005\vc\atlmfc\include\wtl80\atlmisc.h(3260): 参见对正在编译的类 模板 实例化“WTL::CRecentDocumentListBase<T>”的引用
1> with
1> [
1> T=WTL::CRecentDocumentList
1> ]
1>e:\vs2005\vc\atlmfc\include\wtl80\atlmisc.h(3405) : error C2039: “CString”: 不是“ATL”的成员
1>e:\vs2005\vc\atlmfc\include\wtl80\atlmisc.h(3416) : error C2039: “CString”: 不是“ATL”的成员
1>e:\vs2005\vc\atlmfc\include\wtl80\atlmisc.h(3438) : error C2039: “CString”: 不是“ATL”的成员
1>e:\vs2005\vc\atlmfc\include\wtl80\atlmisc.h(3450) : error C2039: “CString”: 不是“ATL”的成员
1>e:\vs2005\vc\atlmfc\include\wtl80\atlmisc.h(3459) : error C2039: “CString”: 不是“ATL”的成员
1>e:\vs2005\vc\atlmfc\include\wtl80\atlmisc.h(3409) : error C2039: “CString”: 不是“ATL”的成员
1>e:\vs2005\vc\atlmfc\include\wtl80\atlmisc.h(3420) : error C2039: “CString”: 不是“ATL”的成员
1>e:\vs2005\vc\atlmfc\include\wtl80\atlmisc.h(3442) : error C2039: “CString”: 不是“ATL”的成员
1>e:\vs2005\vc\atlmfc\include\wtl80\atlmisc.h(3454) : error C2039: “CString”: 不是“ATL”的成员
1>e:\vs2005\vc\atlmfc\include\wtl80\atlmisc.h(3463) : error C2039: “CString”: 不是“ATL”的成员
1>e:\vs2005\vc\atlmfc\include\wtl80\atlctrls.h(2935) : error C2039: “CString”: 不是“ATL”的成员
1> c:\program files\microsoft visual studio 8\vc\atlmfc\include\atlwin.h(2788): 参见对正在编译的类 模板 实例化“WTL::CListViewCtrlT<TBase>”的引用
1> with
1> [
1> TBase=ATL::CWindow
1> ]
1> c:\program files\microsoft visual studio 8\vc\atlmfc\include\atlwin.h(2978): 参见对正在编译的类 模板 实例化“ATL::CWindowImplRoot<TBase>”的引用
1> with
1> [
1> TBase=WTL::CListViewCtrl
1> ]
1> c:\program files\microsoft visual studio 8\vc\atlmfc\include\atlwin.h(3190): 参见对正在编译的类 模板 实例化“ATL::CWindowImplBaseT<TBase,TWinTraits>”的引用
1> with
1> [
1> TBase=WTL::CListViewCtrl,
1> TWinTraits=WTL::CCheckListViewCtrlTraits
1> ]
1> e:\vs2005\vc\atlmfc\include\wtl80\atlctrlx.h(611): 参见对正在编译的类 模板 实例化“ATL::CWindowImpl<T,TBase,TWinTraits>”的引用
1> with
1> [
1> T=WTL::CCheckListViewCtrl,
1> TBase=WTL::CListViewCtrl,
1> TWinTraits=WTL::CCheckListViewCtrlTraits
1> ]
1> e:\vs2005\vc\atlmfc\include\wtl80\atlctrlx.h(714): 参见对正在编译的类 模板 实例化“WTL::CCheckListViewCtrlImpl<T>”的引用
1> with
1> [
1> T=WTL::CCheckListViewCtrl
1> ]
1>e:\vs2005\vc\atlmfc\include\wtl80\atlctrls.h(6099) : error C2039: “CString”: 不是“ATL”的成员
1> c:\program files\microsoft visual studio 8\vc\atlmfc\include\atlwin.h(2788): 参见对正在编译的类 模板 实例化“WTL::CStatusBarCtrlT<TBase>”的引用
1> with
1> [
1> TBase=ATL::CWindow
1> ]
1> c:\program files\microsoft visual studio 8\vc\atlmfc\include\atlwin.h(2978): 参见对正在编译的类 模板 实例化“ATL::CWindowImplRoot<TBase>”的引用
1> with
1> [
1> TBase=WTL::CStatusBarCtrl
1> ]
1> c:\program files\microsoft visual studio 8\vc\atlmfc\include\atlwin.h(3190): 参见对正在编译的类 模板 实例化“ATL::CWindowImplBaseT<TBase,TWinTraits>”的引用
1> with
1> [
1> TBase=WTL::CStatusBarCtrl,
1> TWinTraits=ATL::CControlWinTraits
1> ]
1> e:\vs2005\vc\atlmfc\include\wtl80\atlctrlx.h(1875): 参见对正在编译的类 模板 实例化“ATL::CWindowImpl<T,TBase>”的引用
1> with
1> [
1> T=WTL::CMultiPaneStatusBarCtrl,
1> TBase=WTL::CStatusBarCtrl
1> ]
。。。。。。。。。
1> e:\vs2005\vc\atlmfc\include\wtl80\atlctrlx.h(4813): 参见对正在编译的类 模板 实例化“WTL::CTabViewImpl<T,TBase,TWinTraits>”的引用
1>e:\vs2005\vc\atlmfc\include\wtl80\atlddx.h(311) : error C2039: “CString”: 不是“ATL”的成员
1> e:\vs2005\vc\atlmfc\include\wtl80\atlddx.h(617): 参见对正在编译的类 模板 实例化“WTL::CWinDataExchange<T>”的引用
-------------------------------------------------错误输出-----------------------------
下面是我的预编译头文件的引用:
#include <atlapp.h>
//extern CAppModule _Module;
#include <atlcom.h>
#include <atlhost.h>
#include <atlwin.h>
#include <atlctl.h>
#include <atlsplit.h>
#include <atlframe.h>
#include <atlcrack.h>
#include <atlctrls.h>
#include <atldlgs.h>
#include <atlmisc.h>
#include <atlctrls.h>
#include <atlctrlx.h>
#include <atlddx.h>
#include <comdef.h>
#include <Windows.h>
#include <Winuser.h>
#include <atlgdi.h>
#include <ShellAPI.h>
how can I do?
[解决办法]
接口里用BSTR