请教DLL问题(详细说明)
<P>请教DLL问题(详细说明)<BR>在DLL里写了继承CView类,名为CmView类.在另一个EXE继承DLL里的CmView类<BR>但总是报错(好象是DLL编写有问题)<BR>************************DLL文件*************************<BR><<<<<<<<<<CmView.h>>>>>>>>>><BR>#pragma once<BR>class AFX_EXT_CLASS CmView : public CView<BR>{<BR> DECLARE_DYNAMIC(CmView)<BR>public: <BR> __declspec(dllexport) CmView();<BR> __declspec(dllexport) ~CmView();<BR>};</P><P><<<<<<<<<CmView.Cpp>>>>>>>><BR>#include "stdafx.h"<BR>#include "CmView.h"<BR>IMPLEMENT_DYNAMIC(CmView,CView)<BR>CmView::CmView()<BR>{<BR>}</P>
<P>CmView::~CmView()<BR>{<BR>}</P>
<P>*****************************EXE文件**************************<BR><<<<<<<<<<<<InfoOrganizerView.h>>>>>>>>>>>>><BR>#pragma once<BR>#include "CmView.h"<BR>#pragma comment(lib,"dll.lib")</P>
<P>class CInfoOrganizerView : public CmView<BR>{<BR>protected: <BR> CInfoOrganizerView();<BR> DECLARE_DYNCREATE(CInfoOrganizerView)<BR>public:<BR> CInfoOrganizerDoc* GetDocument() const;<BR> virtual void OnDraw(CDC* pDC); // overridden to draw this view<BR> virtual BOOL PreCreateWindow(CREATESTRUCT& cs);<BR>public:<BR> virtual ~CInfoOrganizerView();<BR>#ifdef _DEBUG<BR> virtual void AssertValid() const;<BR> virtual void Dump(CDumpContext& dc) const;<BR>#endif</P>
<P>protected:<BR> DECLARE_MESSAGE_MAP()<BR>};</P>
<P>#ifndef _DEBUG<BR>inline CInfoOrganizerDoc* CInfoOrganizerView::GetDocument() const<BR> { return reinterpret_cast<CInfoOrganizerDoc*>(m_pDocument); }<BR>#endif</P>
<P><BR><<<<<<<<<<<<<<InfoOrganizerView.h>>>>>>>>><BR>#include "stdafx.h"<BR>#include "InfoOrganizer.h"<BR>#include "InfoOrganizerDoc.h"<BR>#include "InfoOrganizerView.h"</P>
<P>#ifdef _DEBUG<BR>#define new DEBUG_NEW<BR>#endif</P>
<P>IMPLEMENT_DYNCREATE(CInfoOrganizerView, CmView)</P>
<P>BEGIN_MESSAGE_MAP(CInfoOrganizerView, CmView)<BR>END_MESSAGE_MAP()<BR>CInfoOrganizerView::CInfoOrganizerView()<BR>{<BR>}</P>
<P>CInfoOrganizerView::~CInfoOrganizerView()<BR>{<BR>}</P>
<P>BOOL CInfoOrganizerView::PreCreateWindow(CREATESTRUCT& cs)<BR>{<BR> return CmView::PreCreateWindow(cs);<BR>}</P>
<P>void CInfoOrganizerView::OnDraw(CDC* /*pDC*/)<BR>{<BR> CInfoOrganizerDoc* pDoc = GetDocument();<BR> ASSERT_VALID(pDoc);<BR> if (!pDoc)<BR> return;<BR>}</P>
<P>#ifdef _DEBUG<BR>void CInfoOrganizerView::AssertValid() const<BR>{<BR> CmView::AssertValid();<BR>}</P>
<P>void CInfoOrganizerView::Dump(CDumpContext& dc) const<BR>{<BR> CmView::Dump(dc);<BR>}</P>
<P>CInfoOrganizerDoc* CInfoOrganizerView::GetDocument() const // non-debug version is inline<BR>{<BR> ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CInfoOrganizerDoc)));<BR> return (CInfoOrganizerDoc*)m_pDocument;<BR>}<BR>#endif //_DEBUG</P>
<P><BR>报错如下:<BR>InfoOrganizerView.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const CmView::classCmView" (<a href="mailto:?classCmView@CmView@@2UCRuntimeClass@@B" target="_blank" >?classCmView@CmView@@2UCRuntimeClass@@B</A>)<BR>E:\备份程序库\Studio\InfoOrganizer\Debug\InfoOrganizer.exe : fatal error LNK1120: 1 unresolved externals<BR></P>
页:
[1]
