Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

CListView is not a namespace name

Posted on 2003-03-17
20
Medium Priority
?
772 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
  • 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

564 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