| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1216 人关注过本帖
标题:请教DLL问题(详细说明)
取消只看楼主 加入收藏
rxgmoral
Rank: 1
等 级:新手上路
帖 子:45
专家分:0
注 册:2006-1-18
收藏
 问题点数:0 回复次数:0 
请教DLL问题(详细说明)

请教DLL问题(详细说明)
在DLL里写了继承CView类,名为CmView类.在另一个EXE继承DLL里的CmView类
但总是报错(好象是DLL编写有问题)
************************DLL文件*************************
<<<<<<<<<<CmView.h>>>>>>>>>>
#pragma once
class AFX_EXT_CLASS CmView : public CView
{
DECLARE_DYNAMIC(CmView)
public:
__declspec(dllexport) CmView();
__declspec(dllexport) ~CmView();
};

<<<<<<<<<CmView.Cpp>>>>>>>>
#include "stdafx.h"
#include "CmView.h"
IMPLEMENT_DYNAMIC(CmView,CView)
CmView::CmView()
{
}

CmView::~CmView()
{
}

*****************************EXE文件**************************
<<<<<<<<<<<<InfoOrganizerView.h>>>>>>>>>>>>>
#pragma once
#include "CmView.h"
#pragma comment(lib,"dll.lib")

class CInfoOrganizerView : public CmView
{
protected:
CInfoOrganizerView();
DECLARE_DYNCREATE(CInfoOrganizerView)
public:
CInfoOrganizerDoc* GetDocument() const;
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
public:
virtual ~CInfoOrganizerView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif

protected:
DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG
inline CInfoOrganizerDoc* CInfoOrganizerView::GetDocument() const
{ return reinterpret_cast<CInfoOrganizerDoc*>(m_pDocument); }
#endif


<<<<<<<<<<<<<<InfoOrganizerView.h>>>>>>>>>
#include "stdafx.h"
#include "InfoOrganizer.h"
#include "InfoOrganizerDoc.h"
#include "InfoOrganizerView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

IMPLEMENT_DYNCREATE(CInfoOrganizerView, CmView)

BEGIN_MESSAGE_MAP(CInfoOrganizerView, CmView)
END_MESSAGE_MAP()
CInfoOrganizerView::CInfoOrganizerView()
{
}

CInfoOrganizerView::~CInfoOrganizerView()
{
}

BOOL CInfoOrganizerView::PreCreateWindow(CREATESTRUCT& cs)
{
return CmView::PreCreateWindow(cs);
}

void CInfoOrganizerView::OnDraw(CDC* /*pDC*/)
{
CInfoOrganizerDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
return;
}

#ifdef _DEBUG
void CInfoOrganizerView::AssertValid() const
{
CmView::AssertValid();
}

void CInfoOrganizerView::Dump(CDumpContext& dc) const
{
CmView::Dump(dc);
}

CInfoOrganizerDoc* CInfoOrganizerView::GetDocument() const // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CInfoOrganizerDoc)));
return (CInfoOrganizerDoc*)m_pDocument;
}
#endif //_DEBUG


报错如下:
InfoOrganizerView.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const CmView::classCmView" (?classCmView@CmView@@2UCRuntimeClass@@B)
E:\备份程序库\Studio\InfoOrganizer\Debug\InfoOrganizer.exe : fatal error LNK1120: 1 unresolved externals

搜索更多相关主题的帖子: DLL问题 CmView 详细说明 public 
2006-04-06 17:06
快速回复:请教DLL问题(详细说明)
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.043162 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved