C++调试问题
#include "stdafx.h"
#include "Fivechess_44.h"
#include "Fivechess_44Doc.h"
#include "Fivechess_44View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFivechess_44View
IMPLEMENT_DYNCREATE(CFivechess_44View, CView)
BEGIN_MESSAGE_MAP(CFivechess_44View, CView)
//{{AFX_MSG_MAP(CFivechess_44View)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFivechess_44View construction/destruction
CFivechess_44View::CFivechess_44View()
{
// TODO: add construction code here
}
CFivechess_44View::~CFivechess_44View()
{
}
BOOL CFivechess_44View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CFivechess_44View drawing
void CFivechess_44View::OnDraw(CDC* pDC)
{
CFivechess_44Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
void CFivechess_44View::Checkerboard(CDC*pDC)
{
for(int i=0;i<20;i++) //连续画20条竖线
{
pDC->MoveTo(i*50,0); //画笔移动到(i*50,0)点
pDC->LineTo(i*50,1000); // 画笔从(i*50,0)点到(i*50,1000)点
}
for(i=0;i<20;i++) //连续画20条横线
{
pDC->MoveTo(0,i*50);
pDC->LineTo(1000,i*50);
}
}
void CFivechess_44View::OnDraw(CDC* pDC)
{
CFivechess_44Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
Checkerboard(pDC); //调用自定义的画键盘函数
}
/////////////////////////////////////////////////////////////////////////////
// CFivechess_44View printing
BOOL CFivechess_44View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CFivechess_44View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CFivechess_44View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CFivechess_44View diagnostics
#ifdef _DEBUG
void CFivechess_44View::AssertValid() const
{
CView::AssertValid();
}
void CFivechess_44View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CFivechess_44Doc* CFivechess_44View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CFivechess_44Doc)));
return (CFivechess_44Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CFivechess_44View message handlers
调试中出现的问题:D:\C++课程设计\fivechess\Fivechess_44\Fivechess_44View.cpp(76) : error C2084: function 'void __thiscall CFivechess_44View::OnDraw(class CDC *)' already has a body
跪求大佬指教
#include "Fivechess_44.h"
#include "Fivechess_44Doc.h"
#include "Fivechess_44View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFivechess_44View
IMPLEMENT_DYNCREATE(CFivechess_44View, CView)
BEGIN_MESSAGE_MAP(CFivechess_44View, CView)
//{{AFX_MSG_MAP(CFivechess_44View)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFivechess_44View construction/destruction
CFivechess_44View::CFivechess_44View()
{
// TODO: add construction code here
}
CFivechess_44View::~CFivechess_44View()
{
}
BOOL CFivechess_44View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CFivechess_44View drawing
void CFivechess_44View::OnDraw(CDC* pDC)
{
CFivechess_44Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
void CFivechess_44View::Checkerboard(CDC*pDC)
{
for(int i=0;i<20;i++) //连续画20条竖线
{
pDC->MoveTo(i*50,0); //画笔移动到(i*50,0)点
pDC->LineTo(i*50,1000); // 画笔从(i*50,0)点到(i*50,1000)点
}
for(i=0;i<20;i++) //连续画20条横线
{
pDC->MoveTo(0,i*50);
pDC->LineTo(1000,i*50);
}
}
void CFivechess_44View::OnDraw(CDC* pDC)
{
CFivechess_44Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
Checkerboard(pDC); //调用自定义的画键盘函数
}
/////////////////////////////////////////////////////////////////////////////
// CFivechess_44View printing
BOOL CFivechess_44View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CFivechess_44View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CFivechess_44View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CFivechess_44View diagnostics
#ifdef _DEBUG
void CFivechess_44View::AssertValid() const
{
CView::AssertValid();
}
void CFivechess_44View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CFivechess_44Doc* CFivechess_44View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CFivechess_44Doc)));
return (CFivechess_44Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CFivechess_44View message handlers
调试中出现的问题:D:\C++课程设计\fivechess\Fivechess_44\Fivechess_44View.cpp(76) : error C2084: function 'void __thiscall CFivechess_44View::OnDraw(class CDC *)' already has a body
跪求大佬指教
...全文
相关推荐
Dev-c++调试问题解决[源码]
Dev-c++是一个集成开发环境,广泛用于C/C++语言的开发。在Dev-c++中进行程序调试时,可能会遇到一些问题。本文将介绍如何解决Dev-c++无法调试的问题。
极智开发 | vscode c++ 调试无法跳转问题解决教程
网上教程各种坑,有让你把 C/C++和 C++ Intellisense 插件卸载、重装、重启的;也有让你装 GNU Global的。。。试过,问题依旧,下面分享一下我花了两个小时走过的这个坑。
Microsoft Visual C++调试问题
在探讨Microsoft Visual C++调试问题时,我们主要关注的是如何有效地使用Visual C++环境中的调试工具来定位并解决代码中的错误。
MAC中vscode调试C++输入问题解决[可运行源码]
在MAC电脑上使用vscode进行C++代码的调试,开发者经常会遇到无法在调试控制台中输入数据的问题,这会导致调试程序时出现程序无法继续执行的困境。
VSCode调试C++输出问题[可运行源码]
在使用Visual Studio Code(VSCode)进行C++开发时,调试程序的过程中可能会遇到一个常见的问题:程序的输出并没有显示在VSCode的“终端”选项卡中。


