error C2039: "GetLine" in not a member of "class"

..........hello there .....
..........after I compiled my following code ...
.......... I'd appreciate any help
// Day10View.cpp : implementation of the CDay10View class
//

#include "stdafx.h"
#include "Day10.h"

#include "Day10Doc.h"
#include "Day10View.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDay10View

IMPLEMENT_DYNCREATE(CDay10View, CView)

BEGIN_MESSAGE_MAP(CDay10View, CView)
//{{AFX_MSG_MAP(CDay10View)
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_MOUSEMOVE()
//}}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()

/////////////////////////////////////////////////////////////////////////////
// CDay10View construction/destruction

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

}

CDay10View::~CDay10View()
{
}

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

return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CDay10View drawing

void CDay10View::OnDraw(CDC* pDC)
{
CDay10Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
///////////////////////
// MY CODE STARTS HERE
///////////////////////
// Get the number of lines in the document
int liCount = pDoc->GetLineCount(); // where the error occurs
// Are there any lines in the document?
if (liCount)
{
int liPos;
CLine*lptLine;
// Loop through the lines in the document
for (liPos = 0; liPos < liCount; liPos++)
{
// Get the from and to point for each line
lptLine = pDoc->GetLine(liPos); // where the error occurs
// Draw the line
lptLine->Draw(pDC);
}
}
///////////////////////
// MY CODE ENDS HERE
///////////////////////
}

/////////////////////////////////////////////////////////////////////////////
// CDay10View printing

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

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

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

}

/////////////////////////////////////////////////////////////////////////////
// CDay10View diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CDay10View message handlers

void CDay10View::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default

CView::OnLButtonDown(nFlags, point);
}

void CDay10View::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
///////////////////////
// MY CODE STARTS HERE
///////////////////////
// Capture the mouse, so no other application can
// grab it if the mouse leaves the window area
SetCapture();
// Save the point
m_ptPrevPos = point;
///////////////////////
// MY CODE ENDS HERE
///////////////////////
CView::OnLButtonDown(nFlags, point);
}

void CDay10View::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
///////////////////////
// MY CODE STARTS HERE
///////////////////////
// Have we captured the mouse?
if (GetCapture() == this)
// If so, release it so other applications can
// have it
ReleaseCapture();
///////////////////////
// MY CODE ENDS HERE
///////////////////////
CView::OnLButtonUp(nFlags, point);
}

void CDay10View::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
///////////////////////
// MY CODE STARTS HERE
///////////////////////
// Check to see if the left mouse button is down
if ((nFlags & MK_LBUTTON) == MK_LBUTTON)
{
// Have we captured the mouse?
if (GetCapture() == this)
{
// Get the Device Context
CClientDC dc(this);
// Add the line to the document
CLine *pLine = GetDocument()->AddLine(m_ptPrevPos, point);
// Draw the current stretch of line
pLine->Draw(&dc);
// Save the current point as the previous point
m_ptPrevPos = point;
}
}
///////////////////////
// MY CODE ENDS HERE
///////////////////////
CView::OnMouseMove(nFlags, point);
}

...................................the errors are:

-------------------Configuration: Day10 - Win32 Debug--------------------
Compiling...
Day10.cpp
Day10View.cpp
D:\VC++6\MSDev98\MyProjects\Day10\Day10View.cpp(76) : error C2039: 'GetLine' : is not a member of 'CDay10Doc'
d:\vc++6\msdev98\myprojects\day10\day10doc.h(13) : see declaration of 'CDay10Doc'
D:\VC++6\MSDev98\MyProjects\Day10\Day10View.cpp(78) : error C2027: use of undefined type 'CLine'
d:\vc++6\msdev98\myprojects\day10\day10doc.h(12) : see declaration of 'CLine'
D:\VC++6\MSDev98\MyProjects\Day10\Day10View.cpp(78) : error C2227: left of '->Draw' must point to class/struct/union
D:\VC++6\MSDev98\MyProjects\Day10\Day10View.cpp(138) : error C2084: function 'void __thiscall CDay10View::OnLButtonDown(unsigned int,class CPoint)' already has a body
D:\VC++6\MSDev98\MyProjects\Day10\Day10View.cpp(188) : error C2027: use of undefined type 'CLine'
d:\vc++6\msdev98\myprojects\day10\day10doc.h(12) : see declaration of 'CLine'
D:\VC++6\MSDev98\MyProjects\Day10\Day10View.cpp(188) : error C2227: left of '->Draw' must point to class/struct/union
Generating Code...
Compiling...
Day10Doc.cpp
Generating Code...
Error executing cl.exe.

Day10.exe - 6 error(s), 0 warning(s)

and here is Day10.cpp code......................................................

// Day10Doc.h : interface of the CDay10Doc class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_DAY10DOC_H__A12642CF_7E96_4273_B3B5_FA94CD497BEC__INCLUDED_)
#define AFX_DAY10DOC_H__A12642CF_7E96_4273_B3B5_FA94CD497BEC__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


class CDay10Doc : public CDocument
{
protected: // create from serialization only
CDay10Doc();
DECLARE_DYNCREATE(CDay10Doc)

// Attributes
public:

// Operations
public:

// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDay10Doc)
public:
virtual BOOL OnNewDocument();
virtual void Serialize(CArchive& ar);
//}}AFX_VIRTUAL

// Implementation
public:
int GetLineCount();
CLine* AddLine(CPoint ptFrom, CPoint ptTo);
CObArray m_oaLines;
virtual ~CDay10Doc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
//{{AFX_MSG(CDay10Doc)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

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

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

#endif // !defined(AFX_DAY10DOC_H__A12642CF_7E96_4273_B3B5_FA94CD497BEC__INCLUDED_)


Last edited on
Code tags - please - you might not get any replies otherwise.

Also - perhaps this would be better on the windows page - there is a button so you can move there.

In the header file you have a GetLineCount but no GetLine as the compiler says. And you don't show any implementation for either of them ( not that I could see)

HTH
kindly TheIdeasMan can you explain better ......
Topic archived. No new replies allowed.