Mysterious Class Wizard warning message
Jon Meltzer/HHP/International Thomson Publishing
Sunday, June 09, 1996
Platform: Windows 95/ Environment: VC++ 1.52, MFC 2.5 (but I get the same
error using VC++ 4.1)
Excuse the following if it is a naive question, but I'm stumped:
I'm trying to use the VC++ 1.52 Class Wizard (development platform: Windows 95)
to create a new derived class. I create my dialog in AppStudio, click on the
ClassWizard, get the "select class" dialog, select the class I want to derive
the new one from, and get the message:
"A duplicate insert block was found for class CConjView in the source files
(conjview.h, conjview.cpp)".
Now, the conjview.* files were written by another programmer, who is currently
not available. But the files compile OK. (CConjView is derived from CFormView,
and I don't see any problems in how it is created.)
I tried rebuilding the .CLW file. No luck.
My questions are:
- what does the message mean,
- are the ClassWizard warning messages documented; (I've looked in the help,
the printed books, and the knowledge base), and
- what should I be looking for in the code so that I can fix things and get the
wiz to accept a new derived class?
I'd appreciate any help, and would be happy to send the offending code if
necessary.
Thanks,
Jon Meltzer
Heinle & Heinle/ITP
Alex Sevugan -- asevugan@csci.csc.com
Monday, June 10, 1996
[Mini-digest: 3 responses]
Hi Jon,
Could you send the offending code. I think I might be able to help.
Alaks
-----From: Amir Salzberg
Maby you should delete the previous conjview.* files or at list rename them
-----From: George Voronoff
I'm just shooting from the hip here but you might have a look at the Dialog
Constructors.
Class wizard provies a default constructor that initializes any member
variables that
were created via class wizard:
//{{AFX_DATA_INIT(CConjView)
m_foo = 0.0
m_bar = 9.9
//}}AFX_DATA_INIT
If there is more than one constructor, and this code appears in each, Class
Wizard Barfs.
The workaround is to put the init data into a subroutine and call this
subroutine
from both constructors.
good luck
Les.L.J.Benson@lee0101.wins.icl.co.uk
Tuesday, June 11, 1996
[Mini-digest: 4 responses]
Have you checked to see if the CLW blocks are duplicated i.e the
lines that read //{{AFX_MSG_MAP(CMyClass) to //}}AFX_MSG_MAP
in the .cpp and between //{{AFX_MSG(CMyClass) thru //}}AFX_MSG
in the .h
These are the place markers for Classwizard, so these could be
duplicated. Rgds Les Benson
-----From: Anthony Garrigan
I have had similar messages generated when duplicate class declarations
have been made in either the *h or *.cpp files. In the situations that it
has happened I cannot fully remember and I donot know why the compiler did
not complain. Anyway this is worth checking out. The class wizard parses
the files and if any duplication are made an error is generated.
I hope this helps
> > > >
-----From: Terry Trippany
Hi,
>"A duplicate insert block was found for class CConjView in the source files
>(conjview.h, conjview.cpp)".
It should compile OK because the class wizard is parsing comments to read in
it's database information. You should look in the header file for one of
the following duplicate blocks
//{{AFX_MSG(CMainFrame)
//}}AFX_MSG
or
//{{AFX_VIRTUAL(CMainFrame)
//}}AFX_VIRTUAL
Try looking up MFC Message Maps in something like the InfoViewer or MSDN for
more info.
Hope this helps.
Terry Trippany
terryt@str.com
Senior Consultant
Strategic Technology Resources
Chicago, IL
-----From: Jon Meltzer/HHP/International Thomson Publishing
I tried George Voronoff's fix, and it worked. So now I know what the ClassWiz
defines an "insert block" as ...
I wish the term was indexed somewhere in the help and documentation, though.
Thanks for the help.
| Вернуться в корень Архива
|