求助,出现错误,大神指点一下……不胜感激

天山剑客 2010-12-13 09:19:23
我按着书写桥的代码,出现这个提示,不知道头文件该怎么改?求大神指点一二,不胜感激


请问如何解决error C2511: 'Create' : overloaded member function 'int (class CWnd *)' not found in 'CSplashWnd'
d:\program\vc\txt\txt\splashwnd.h(13) : see declaration of 'CSplashWnd'
// SplashWnd.cpp : implementation file
//


SplashWnd.cpp 为:


#include "stdafx.h"
#include "txt.h"
#include "SplashWnd.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CSplashWnd

CSplashWnd::CSplashWnd()
{
}

CSplashWnd::~CSplashWnd()
{
}


BEGIN_MESSAGE_MAP(CSplashWnd, CWnd)
//{{AFX_MSG_MAP(CSplashWnd)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()


BOOL CSplashWnd::Create(CWnd* pParentWnd/*=NULL*/)
{
if(!m_bitmap.LoadBitmap(IDB_SPLASH))
return FALSE;
BITMAP bm;
m_bitmap.GetBitmap(&bm);//得到位图句柄
//创建启动窗口
return CreateEx(0,AfxRegisterWndClass(0,AfxGetApp()->LoadStandardCursor(IDC_ARROW)),NULL,WS_POPUP|WS_VISIBLE,
0,0,bm.bmWidth,bm.bmHeight,pParentWnd->GetSafeHwnd(),NULL);
}

---------------------------------------------------------------------

这个是头文件 SplashWnd.h 为::
#if !defined(AFX_SPLASHWND_H__81B350DC_46B4_4DB7_9AA4_CD6C1B458A1D__INCLUDED_)
#define AFX_SPLASHWND_H__81B350DC_46B4_4DB7_9AA4_CD6C1B458A1D__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// SplashWnd.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CSplashWnd window

class CSplashWnd : public CWnd
{
// Construction
public:
CSplashWnd();

// Attributes
public:

// Operations
public:

// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSplashWnd)
public:
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
//}}AFX_VIRTUAL

// Implementation
public:
virtual ~CSplashWnd();

// Generated message map functions
protected:
//{{AFX_MSG(CSplashWnd)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_SPLASHWND_H__81B350DC_46B4_4DB7_9AA4_CD6C1B458A1D__INCLUDED_)

...全文
114 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
witlym311 2010-12-14
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 zclstart 的回复:]
这样改过又出现6个错误 --------------------Configuration: NotePad - Win32 Debug--------------------
Compiling...
SplashWnd.cpp
F:\C++\NotePad\SplashWnd.cpp(37) : error C2447: missing function header (old-styl……
[/Quote]

在MSDN 里查,学编程不安装MSDN是学不好的。
天山剑客 2010-12-14
  • 打赏
  • 举报
回复
好像是要改动头文件,求指点……………………
[Quote=引用 7 楼 gules 的回复:]
引用 3 楼 arong1234 的回复:
类声明中:virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);

……
[/Quote]
天山剑客 2010-12-14
  • 打赏
  • 举报
回复
这样改过又出现6个错误 --------------------Configuration: NotePad - Win32 Debug--------------------
Compiling...
SplashWnd.cpp
F:\C++\NotePad\SplashWnd.cpp(37) : error C2447: missing function header (old-style formal list?)
F:\C++\NotePad\SplashWnd.cpp(45) : error C2065: 'm_bitmap' : undeclared identifier
F:\C++\NotePad\SplashWnd.cpp(45) : error C2228: left of '.LoadBitmapA' must have class/struct/union type
F:\C++\NotePad\SplashWnd.cpp(45) : error C2065: 'IDB_SPLASH' : undeclared identifier
F:\C++\NotePad\SplashWnd.cpp(48) : error C2228: left of '.GetBitmap' must have class/struct/union type
F:\C++\NotePad\SplashWnd.cpp(51) : error C2065: 'CreateEX' : undeclared identifier
Error executing cl.exe.

NotePad.exe - 6 error(s), 0 warning(s)
[Quote=引用 7 楼 gules 的回复:]
引用 3 楼 arong1234 的回复:
类声明中:virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);

……
[/Quote]
gules 2010-12-14
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 arong1234 的回复:]
类声明中:virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);

实现:BOOL CSplashWnd::Crea……
[/Quote]

对,实现与声明不一致。

BOOL CSplashWnd::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
……
}
天山剑客 2010-12-14
  • 打赏
  • 举报
回复
主要是怎么改的问题?求助[Quote=引用 3 楼 arong1234 的回复:]
类声明中:virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);

实现:BOOL CSplashWnd::Crea……
[/Quote]
天山剑客 2010-12-14
  • 打赏
  • 举报
回复
将实现的参数和声明中的对齐的话,会出现6个错误…………迷茫[Quote=引用 3 楼 arong1234 的回复:]
类声明中:virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);

实现:BOOL CSplashWnd::Crea……
[/Quote]
CJBAAA 2010-12-14
  • 打赏
  • 举报
回复
lz要好好学习了
arong1234 2010-12-14
  • 打赏
  • 举报
回复
类声明中:virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);

实现:BOOL CSplashWnd::Create(CWnd* pParentWnd/*=NULL*/)

差这么多参数也发现不了?
龙哥依旧 2010-12-14
  • 打赏
  • 举报
回复
你声明的Create和定义的参数不一样
天山剑客 2010-12-13
  • 打赏
  • 举报
回复
F:\C++\NotePad\SplashWnd.cpp(43) : error C2511: 'Create' : overloaded member function 'int (class CWnd *)' not found in 'CSplashWnd'
f:\c++\notepad\splashwnd.h(13) : see declaration of 'CSplashWnd'


这个怎么解决的?小弟不胜感激啊~~~

64,637

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧