🔒 Locked
Simple MFC question....
Advertisement
Original Post
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]
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
Always remember this it saves lots of time
Are you sure you have put #include <afxcview.h>?
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.
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.
Can you post the code where your class that derive from CListView is declared?
thx
thx
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.
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.
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
.
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
5) Rebuild-All.
p/s: 0) Which version of MSVC you are using? My office have MSVC5
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement