| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1421 人关注过本帖
标题:【求助】这段程序哪出错了
只看楼主 加入收藏
youxin123
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2016-5-9
结帖率:0
收藏
 问题点数:0 回复次数:2 
【求助】这段程序哪出错了
// asaView.cpp : implementation of the CAsaView class
//

#include "stdafx.h"
#include "asa.h"

#include "asaDoc.h"
#include "asaView.h"


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

/////////////////////////////////////////////////////////////////////////////
// CAsaView

IMPLEMENT_DYNCREATE(CAsaView, CView)

BEGIN_MESSAGE_MAP(CAsaView, CView)
    //{{AFX_MSG_MAP(CAsaView)
        // 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()

/////////////////////////////////////////////////////////////////////////////
// CAsaView construction/destruction

CAsaView::CAsaView()
{
    // TODO: add construction code here

}

CAsaView::~CAsaView()
{
}

BOOL CAsaView::PreCreateWindow(CREATESTRUCT& cs)
{
    // TODO: Modify the Window class or styles here by modifying
    //  the CREATESTRUCT cs

    return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CAsaView drawing

void CAsaView::OnDraw(CDC* pDC)
{
    CAsaDoc* pDoc = GetDocument();
    ASSERT_VALID(pDoc);
    void CPolyView::OnDraw(CDC* pDC)
    {
        CPolyDoc* pDoc=GetDocument();
        ASSERT_VALID(pDoc);
        CRect RndRC(-54,38,49,0);
        pDC->RoundRect(RndRC,CPoint(15,15));
        }
    // TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CAsaView printing

BOOL CAsaView::OnPreparePrinting(CPrintInfo* pInfo)
{
    // default preparation
    return DoPreparePrinting(pInfo);
}

void CAsaView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
    // TODO: add extra initialization before printing
}

void CAsaView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
    // TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CAsaView diagnostics

#ifdef _DEBUG
void CAsaView::AssertValid() const
{
    CView::AssertValid();
}

void CAsaView::Dump(CDumpContext& dc) const
{
    CView::Dump(dc);
}

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

/////////////////////////////////////////////////////////////////////////////
// CAsaView message handlers



显示问题如下:
--------------------Configuration: asa - Win32 Debug--------------------
Compiling...
asaView.cpp
E:\1\asa\asaView.cpp(61) : error C2653: 'CPolyView' : is not a class or namespace name
E:\1\asa\asaView.cpp(62) : error C2601: 'OnDraw' : local function definitions are illegal
执行 cl.exe 时出错.

asa.exe - 1 error(s), 0 warning(s)
搜索更多相关主题的帖子: include 
2016-05-28 11:05
lanke711
Rank: 9Rank: 9Rank: 9
来 自:流浪在天国之路
等 级:蜘蛛侠
威 望:7
帖 子:317
专家分:1437
注 册:2015-7-16
收藏
得分:0 
1.'CPolyView' : is not a class or namespace name
提示已经说明了,这个名称 不是类名,或者不是一个名称空间名。要么是你的头文件从别的地方复制过来导致的。要么就是你没有定义这个名称。
别外一个问题,如:#include <iostream> 不能写成<iostream.h>  C++新标准,不带.h扩展名除了改进之外,还放进了std名称空间中.
 2.'OnDraw' : local function definitions are illegal
这个提示说明,不管是C还是C++,都不能在函数内定义函数。明显楼主已经正在这样做了。

普通人之所以普通,是因为他们普遍有一个通病,那就是认为自己永远普通。
千夫所指,我亦坚持。就算被所有人误解,我也照样守护这一切。
我们总是觉得,这些灵魂的表情,傲慢自大,目中无人,其实,真正目中无人的是我们。它们傲慢的不过是表情,而我们傲慢的却是行为!
记得,是为了忘记!
只要想着有那么一天,我就能忍受现在的每一天!
灾难并不可怕,可怕的是心中没有了希望。
你以为我在天堂,其实我正在路上。
当你觉得自己走不到终点的时候,请不要放弃。或许你的对手也是这种感觉。
2016-05-28 12:30
lanke711
Rank: 9Rank: 9Rank: 9
来 自:流浪在天国之路
等 级:蜘蛛侠
威 望:7
帖 子:317
专家分:1437
注 册:2015-7-16
收藏
得分:0 
忘了。#include <iostream.h>的话,可以直接使用cout打印。而使用#include <iostream>,需要using namespace std; 刚刚想写的,忘了写进去

普通人之所以普通,是因为他们普遍有一个通病,那就是认为自己永远普通。
千夫所指,我亦坚持。就算被所有人误解,我也照样守护这一切。
我们总是觉得,这些灵魂的表情,傲慢自大,目中无人,其实,真正目中无人的是我们。它们傲慢的不过是表情,而我们傲慢的却是行为!
记得,是为了忘记!
只要想着有那么一天,我就能忍受现在的每一天!
灾难并不可怕,可怕的是心中没有了希望。
你以为我在天堂,其实我正在路上。
当你觉得自己走不到终点的时候,请不要放弃。或许你的对手也是这种感觉。
2016-05-28 12:32
快速回复:【求助】这段程序哪出错了
数据加载中...
 
   



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

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