?
Solved

CListView is not a namespace name

Posted on 2003-03-17
20
Medium Priority
?
768 Views
Last Modified: 2013-11-20
Hi

I have derived a class from CListView but it is apparently
not defined. I  must be missing something!

what gives?

0
Comment
Question by:mjwilliamson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 11
  • 5
  • 2
  • +1
20 Comments
 
LVL 12

Expert Comment

by:williamcampbell
ID: 8153220


  Tools / Options / Directories is MFC include dir there?
0
 

Author Comment

by:mjwilliamson
ID: 8153267
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\MFC

just added above and still not compiling
0
 

Author Comment

by:mjwilliamson
ID: 8153278
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\MFC

just added above and still not compiling
0
Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

 
LVL 12

Expert Comment

by:williamcampbell
ID: 8153292
:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\MFC\include
0
 

Author Comment

by:mjwilliamson
ID: 8153338
yep tried it and no joy
0
 
LVL 12

Expert Comment

by:williamcampbell
ID: 8153366
Whats the error?
0
 

Author Comment

by:mjwilliamson
ID: 8153416
error C2504: 'CListView' : base class undefined

error C2653: 'CListView' : is not a class or namespace name
0
 
LVL 4

Expert Comment

by:mblat
ID: 8154490
check if you have

#include <afxcmn.h>

line in your stdafx.h

file.
0
 

Author Comment

by:mjwilliamson
ID: 8154557
yep
0
 
LVL 4

Expert Comment

by:mblat
ID: 8154591
Hmmm...

Did you tried to include this header into the file where you derived you custom class?

What version of compiler you are using? OS?

post stdafx.h here and header for you derived class.
0
 

Author Comment

by:mjwilliamson
ID: 8154819
Hi

I tried including afxcmn.h but no difference, I think
a re-install could be order.

using VS6.0 and Windows XP Pro

stdafx.h

// stdafx.h : include file for standard system include files,
//  or project specific include files that are used frequently, but
//      are changed infrequently
//

#if !defined(AFX_STDAFX_H__E6B15629_7F0E_4FEE_B830_706AF1426513__INCLUDED_)
#define AFX_STDAFX_H__E6B15629_7F0E_4FEE_B830_706AF1426513__INCLUDED_

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

#define VC_EXTRALEAN            // Exclude rarely-used stuff from Windows headers

#include <afxwin.h>         // MFC core and standard components
#include <afxext.h>         // MFC extensions
#include <afxole.h>         // MFC OLE classes
#include <afxodlgs.h>       // MFC OLE dialog classes
#include <afxdisp.h>        // MFC Automation classes
#include <afxdtctl.h>            // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h>                  // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT


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

#endif // !defined(AFX_STDAFX_H__E6B15629_7F0E_4FEE_B830_706AF1426513__INCLUDED_)


MyListView.h

#if !defined(AFX_MYLISTVIEW_H__391035FB_54EB_49B2_9939_93FB10F9A01F__INCLUDED_)
#define AFX_MYLISTVIEW_H__391035FB_54EB_49B2_9939_93FB10F9A01F__INCLUDED_

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

/////////////////////////////////////////////////////////////////////////////
// CMyListView view

class CMyListView : public CListView
{
protected:
      CMyListView();           // protected constructor used by dynamic creation
      DECLARE_DYNCREATE(CMyListView)

// Attributes
public:

// Operations
public:

// Overrides
      // ClassWizard generated virtual function overrides
      //{{AFX_VIRTUAL(CMyListView)
      protected:
      virtual void OnDraw(CDC* pDC);      // overridden to draw this view
      //}}AFX_VIRTUAL

// Implementation
protected:
      virtual ~CMyListView();
#ifdef _DEBUG
      virtual void AssertValid() const;
      virtual void Dump(CDumpContext& dc) const;
#endif

      // Generated message map functions
protected:
      //{{AFX_MSG(CMyListView)
            // 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_MYLISTVIEW_H__391035FB_54EB_49B2_9939_93FB10F9A01F__INCLUDED_)


MyListView.cpp

// MyListView.cpp : implementation file
//

#include "stdafx.h"
#include "MyApp.h"
#include "MyListView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMyListView

IMPLEMENT_DYNCREATE(CMyListView, CListView)

CMyListView::CMyListView()
{
}

CMyListView::~CMyListView()
{
}


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

/////////////////////////////////////////////////////////////////////////////
// CMyListView drawing

void CMyListView::OnDraw(CDC* pDC)
{
      CListView::OnDraw(pDC);

      // TODO: add draw code here
}

/////////////////////////////////////////////////////////////////////////////
// CMyListView diagnostics

#ifdef _DEBUG
void CMyListView::AssertValid() const
{
      CListView::AssertValid();
}

void CMyListView::Dump(CDumpContext& dc) const
{
      CListView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMyListView message handlers


0
 

Author Comment

by:mjwilliamson
ID: 8154856
compiler output

mylistview.h(16) : error C2504: 'CListView' : base class undefined
MyListView.cpp(18) : error C2440: 'return' : cannot convert from 'class CMyListView *' to 'class CObject *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
MyListView.cpp(18) : error C2653: 'CListView' : is not a class or namespace name
MyListView.cpp(18) : error C2065: 'classCListView' : undeclared identifier
MyListView.cpp(29) : error C2653: 'CListView' : is not a class or namespace name
MyListView.cpp(40) : error C2653: 'CListView' : is not a class or namespace name
MyListView.cpp(51) : error C2653: 'CListView' : is not a class or namespace name
MyListView.cpp(56) : error C2653: 'CListView' : is not a class or namespace name
0
 
LVL 12

Expert Comment

by:williamcampbell
ID: 8154858


 Is stdafx.h included in your listview cpp before litview.h?
0
 

Author Comment

by:mjwilliamson
ID: 8154914
unfortunately yes - :-(
0
 

Author Comment

by:mjwilliamson
ID: 8155324
ok hows this then

afxcmn.h has no CListView entries.
further search for CListView in files on C:
drive yields no results!!!
0
 

Author Comment

by:mjwilliamson
ID: 8155382
so much for the ms search,

header file for CListView is afxcview.h

thanks for the help guys
what to do with the points?
0
 

Accepted Solution

by:
PhilJ1 earned 100 total points
ID: 8155410
I don't think I saw afxcview.h included.
Try this,

      #include <afxcview.h>

0
 

Expert Comment

by:PhilJ1
ID: 8155417
Ah, you beat me to it. :)
0
 
LVL 12

Expert Comment

by:williamcampbell
ID: 8155521

 

 PhilJ1 an have em since he has none :)
 
0
 

Author Comment

by:mjwilliamson
ID: 8157906
wc your a gentleman - thanks guys
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question