本人在vc6.0下调试一个程序出现以下错误,希望得到大家都帮助!谢谢
D:\学习\vc练习\2DCAD\2DCADView.cpp(89) : error C2039: 'Ellipse' : is not a member of 'CMy2DCADDoc'
        d:\学习\vc练习\2dcad\2dcaddoc.h(13) : see declaration of 'CMy2DCADDoc'
D:\学习\vc练习\2DCAD\2DCADView.cpp(239) : error C2065: 'CMy2DCADDOC' : undeclared identifier
D:\学习\vc练习\2DCAD\2DCADView.cpp(239) : error C2065: 'pDoc' : undeclared identifier
D:\学习\vc练习\2DCAD\2DCADView.cpp(239) : error C2440: '=' : cannot convert from 'class CMy2DCADDoc *' to 'int'
        This conversion requires a reinterpret_cast, a C-style cast or function-style cast
D:\学习\vc练习\2DCAD\2DCADView.cpp(256) : error C2227: left of '->m_nPointNum' must point to class/struct/union
D:\学习\vc练习\2DCAD\2DCADView.cpp(257) : error C2227: left of '->m_Point' must point to class/struct/union
D:\学习\vc练习\2DCAD\2DCADView.cpp(258) : error C2227: left of '->m_Point' must point to class/struct/union
D:\学习\vc练习\2DCAD\2DCADView.cpp(260) : error C2227: left of '->m_nPointNum' must point to class/struct/union
D:\学习\vc练习\2DCAD\2DCADView.cpp(283) : error C2227: left of '->m_nLineNum' must point to class/struct/union
D:\学习\vc练习\2DCAD\2DCADView.cpp(284) : error C2227: left of '->m_Line' must point to class/struct/union
D:\学习\vc练习\2DCAD\2DCADView.cpp(285) : error C2227: left of '->m_Line' must point to class/struct/union
D:\学习\vc练习\2DCAD\2DCADView.cpp(286) : error C2227: left of '->m_Line' must point to class/struct/union
D:\学习\vc练习\2DCAD\2DCADView.cpp(287) : error C2227: left of '->m_Line' must point to class/struct/union
D:\学习\vc练习\2DCAD\2DCADView.cpp(289) : error C2227: left of '->m_nLineNum' must point to class/struct/union

解决方案 »

  1.   

    出问题的代码为:
    if(m_bIsPoint)//如果程序处于画点状态
    {
    //调用CDC::Ellipse函数以点为中心,画一个小的圆圈
    dc.Ellipse(point.x-2, point.y-2, point.x+2, point.y+2); //修改文档中的记录点的数据成员
    int i = pDoc->m_nPointNum;
    pDoc->m_Point[i][0] = point.x; //记录点的坐标值
    pDoc->m_Point[i][1] = point.y;

    pDoc->m_nPointNum ++;      //点数加1
    }
    以及:
    else//如果是线段终点,则在视图区中画出线段
    {
    dc.MoveTo(m_nStartX, m_nStartY);
    dc.LineTo(point.x, point.y);//使用MoveTo、LineTo函数画线 //修改文档中的记录点的数据成员
    int i = pDoc->m_nLineNum;
    pDoc->m_Line[i][0] = m_nStartX;  //记录线段起点坐标
    pDoc->m_Line[i][1] = m_nStartY;
    pDoc->m_Line[i][2] = point.x;  //记录线段终点坐标
    pDoc->m_Line[i][3] = point.y; pDoc->m_nLineNum ++;   //线段总数加1 m_nStep = 0;//完成一次画线段后,将操作步数归零
    m_nStartX = m_nStartY = 0;//将记录起点坐标归零
    m_nEndX = m_nEndY = 0;//将终点坐标归零 ::ReleaseCapture();//释放鼠标捕捉
    }
      

  2.   

    'Ellipse' : is not a member of 'CMy2DCADDoc' //请确认dc的定义为CDC
    'CMy2DCADDOC' : undeclared identifier //包含My2DCADDOC.h
      

  3.   

    去人包含了能有ellipse的同文件
      

  4.   

    类和头文件是不是要名字一致呢?
    考虑把2DCADDoc.h 改为CMy2DCADDoc.h
    然后在2DCADView.cpp把2DCADDoc.h 改成CMy2DCADDoc.h试验下
    反正是没有引入CMy2DCADDoc类,所有ERR都是这个原因导致的
      

  5.   

    感谢大家都帮助,现在的问题变成了以下提示:
    D:\学习\vc练习\2DCAD\2DCADView.cpp(88) : error C2065: 'pDc' : undeclared identifier
    D:\学习\vc练习\2DCAD\2DCADView.cpp(88) : error C2227: left of '->Ellipse' must point to class/struct/union
    问题代码如下:
    for(int i=0;i<pDoc->m_nPointNum;i++)
    {
    int x = pDoc->m_Point[i][0];
    int y = pDoc->m_Point[i][1]; pDc->Ellipse(x-2,y-2,x+2,y+2);
    }