Problem:
   我有一从CWnd派生的类,我把它做在一个静态连接库里面,(此库用到了CString 和CWnd的一些消息处理),然后连接到应用程序里时出现了如下错误://///////////////////////////////////////////////////////////
Linking...
nafxcw.lib(wincore.obj) : error LNK2005: "public: __thiscall CWnd::CWnd(void)" (??0CWnd@@QAE@XZ) already defined in mfc42d.lib(MFC42D.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual void __thiscall CWnd::PreSubclassWindow(void)" (?PreSubclassWindow@CWnd@@UAEXXZ) already defined in mfc42d.lib(MFC42D.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual int __thiscall CWnd::PreCreateWindow(struct tagCREATESTRUCTA &)" (?PreCreateWindow@CWnd@@UAEHAAUtagCREATESTRUCTA@@@Z) already defined in mfc42d.lib(MFC42D.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual int __thiscall CWnd::Create(char const *,char const *,unsigned long,struct tagRECT const &,class CWnd *,unsigned int,struct CCreateContext *)" (?Create@CWnd@@UAEHPBD0KABUtagRECT@@PAV1@IPAUCCr
eateContext@@@Z) already defined in mfc42d.lib(MFC42D.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual __thiscall CWnd::~CWnd(void)" (??1CWnd@@UAE@XZ) already defined in mfc42d.lib(MFC42D.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "protected: virtual void __thiscall CWnd::PostNcDestroy(void)" (?PostNcDestroy@CWnd@@MAEXXZ) already defined in mfc42d.lib(MFC42D.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual void __thiscall CWnd::OnFinalRelease(void)" (?OnFinalRelease@CWnd@@UAEXXZ) already defined in mfc42d.lib(MFC42D.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual int __thiscall CWnd::DestroyWindow(void)" (?DestroyWindow@CWnd@@UAEHXZ) already defined in mfc42d.lib(MFC42D.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "protected: virtual long __thiscall CWnd::DefWindowProcA(unsigned int,unsigned int,long)" (?DefWindowProcA@CWnd@@MAEJIIJ@Z) already defined in mfc42d.lib(MFC42D.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "protected: virtual long (__stdcall** __thiscall CWnd::GetSuperWndProcAddr(void))(struct HWND__ *,unsigned int,unsigned int,long)" (?GetSuperWndProcAddr@CWnd@@MAEPAP6GJPAUHWND__@@IIJ@ZXZ) already defined in m
fc42d.lib(MFC42D.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual int __thiscall CWnd::PreTranslateMessage(struct tagMSG *)" (?PreTranslateMessage@CWnd@@UAEHPAUtagMSG@@@Z) already defined in mfc42d.lib(MFC42D.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual int __thiscall CWnd::OnToolHitTest(class CPoint,struct tagTOOLINFOA *)const " (?OnToolHitTest@CWnd@@UBEHVCPoint@@PAUtagTOOLINFOA@@@Z) already defined in mfc42d.lib(MFC42D.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual void __thiscall CWnd::WinHelpA(unsigned long,unsigned int)" (?WinHelpA@CWnd@@UAEXKI@Z) already defined in mfc42d.lib(MFC42D.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "protected: virtual long __thiscall CWnd::WindowProc(unsigned int,unsigned int,long)" (?WindowProc@CWnd@@MAEJIIJ@Z) already defined in mfc42d.lib(MFC42D.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "protected: virtual int __thiscall CWnd::OnWndMsg(unsigned int,unsigned int,long,long *)" (?OnWndMsg@CWnd@@MAEHIIJPAJ@Z) already defined in mfc42d.lib(MFC42D.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "protected: virtual int __thiscall CWnd::OnCommand(unsigned int,long)" (?OnCommand@CWnd@@MAEHIJ@Z) already defined in mfc42d.lib(MFC42D.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "protected: virtual int __thiscall CWnd::OnNotify(unsigned int,long,long *)" (?OnNotify@CWnd@@MAEHIJPAJ@Z) already defined in mfc42d.lib(MFC42D.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual class CScrollBar * __thiscall CWnd::GetScrollBarCtrl(int)const " (?GetScrollBarCtrl@CWnd@@UBEPAVCScrollBar@@H@Z) already defined in mfc42d.lib(MFC42D.DLL)
nafxcw.lib(wincore.obj) : error LNK2005: "public: virtual void __thiscall CWnd::CalcWindowRect(struct tagRECT *,unsigned int)" (?CalcWindowRect@CWnd@@UAEXPAUtagRECT@@I@Z) already defined in mfc42d.lib(MFC42D.DLL)
等等。
//////////////////////////////////////////////////////////////////////////为什么会如此?
如果做成DLL的形式,我需要的是一个CWnd* 的POINTER,然后对此POINTER指向的
CWnd对象在DLL 中处理,结果出现了
“Access Violation”的错误。
/////////////////////////////////////////
老大们,我怎么办?