Skip to main content
gamedev.net
🔒 Locked

Simple MFC question....

Started by Mike Jul 31, 2002 at 11:04 AM 8 replies 3k views
Original Post
Mike
Mike
No, i'm not making a game with MFC. Yes, i realize you can make games with MFC. I'm trying to add a new class to my project. The class is derived from CListView (using class wizard). When I go to compile the CFileListView.cpp (my derived class) I get the following error: error C2504: 'CListView' : base class undefined How do I fix this? I don't know much about MFC, I usually prefer to go with straight Win32 API. I don't have any idea as to how I would fix this. mike. [edited by - mike on July 31, 2002 12:05:33 PM]
Sneftel
Sneftel
Clean and recompile; it''s possible the precompiled headers didn''t update properly.



Don''t listen to me. I''ve had too much coffee.
GimpMaster
GimpMaster
Yes with mfc and some other applications when ever you start getting some strange errors...before spending hours trying to figure out hit alt-b and then R this will rebuild all.

Always remember this it saves lots of time
Mike
Mike
I tried that before I posted the message, any other ideas? I can add a new class based on CEditView with no problem. Does it have something to do with the fact that I already have a CHtmlView class in the project?

[edited by - mike on July 31, 2002 12:21:27 PM]
HiddenInBSP
HiddenInBSP
Are you sure you have put #include <afxcview.h>?
Mike
Mike
No, i didn''t include that file, i just ran the class wizard. I added that include statement and it didn''t chance the results. I tried to create a new project and add a class based on CListView to it. I got the same error message.

Next, i tried creating another new project but in the setup wizard I chose to use CListView as the base class for my project and I then added a class based On CHtmlView to the project and everything work properly. Why doesn''t it work when I do the oposite.

I also tried to create a project that was not based on the document/view architecture. I then added a class based on CListView to that project. Again I get an error message telling me that the base class is undefined.

I still don''t like MFC.
HiddenInBSP
HiddenInBSP
Can you post the code where your class that derive from CListView is declared?

thx
daerid
daerid
Did you specify the derivation in the ClassWizard? Or did you add it later?

Make absolutely sure that the first file that your .cpp file includes is "stdafx.h"

then right under that you can include or whatever it is
daerid@gmail.com
waterLINK
waterLINK
When you derive a class with the Wizard you have first to choose beteewn:

MFC Class
Generic Class
Form Class

I want to think you did it with the first option. If you do it so, you only have then to add #include <afxcview.h>

That''s all, really, I have done it now

Hi.
My mind is similar to yours, but I know where you are.

Hi.My mind is similar to yours, but I know where you are.
DerekSaw
DerekSaw
Things to check:
1) Project|Settings|C/C++|Pre-compiled header:
for StdAfx.cpp: Generate Pre-compile header: Stdafx.h
for others .cpp: Use Precompile header: Stdafx.h
2) Every .cpp file includes StdAfx.h at the TOP
3) all your #include <afx*.h> should be inside StdAfx.h
4) It is also good (for myself ) to have STL included in StdAfx.h
5) Rebuild-All.

p/s: 0) Which version of MSVC you are using? My office have MSVC5 .
"after many years of singularity, i'm still searching n the event horizon" o

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.