Class Wizard reports Duplicate Insert Block
Fred Wright -- FRED@bpadvert.demon.co.uk
Wednesday, June 26, 1996
Hi
VC++ 4.1 Win95
Class Wizard reports a Duplicate insert block for "ControlsDlg"
in the .h and .cpp files of ControlsDlg. I can see no duplicated
lines anywhere, any ideas what this means?
Best Regards
Fred Wright
Manos D. Anastasiadis -- manos@ced.tuc.gr
Monday, July 01, 1996
[Mini-digest: 3 responses]
Since there is no MFC class with the name ControlsDlg,
the only reasonable answer to this is that you have probably
created a new class by copying the ControlsDlg.* files
to a new name and changed the class name in every place.
This happened to me once when I forgot to rename
the class wizard code (lines that begin with either
//{{AFX_ or //}}AFX_) and/or the message map definitions.
So check these out in your .h and .cpp files.
If this is not the case, then it is possible that the CLW
database contains obsolete entries (a class in a file removed=20
by the project ...) and needs to be refreshed.
/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*
* Manos D. Anastasiadis *
* Computer Engineering Dept. *
* Technical University of Crete *
* Mu.S.I.C. *
* manos@ced.tuc.gr *
=
*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
--------------------------------------
From: Fred Wright[SMTP:FRED@bpadvert.demon.co.uk]
Sent: =D4=E5=F4=DC=F1=F4=E7, 26 =C9=EF=F5=ED=DF=EF=F5 1996 10:41 =F0=EC
To: mfc-l@netcom.com
Subject: Class Wizard reports Duplicate Insert Block
Hi
VC++ 4.1 Win95
Class Wizard reports a Duplicate insert block for "ControlsDlg"
in the .h and .cpp files of ControlsDlg. I can see no duplicated=20
lines anywhere, any ideas what this means?
Best Regards
Fred Wright
-----From: Ed Lenox <101721.2225@CompuServe.COM>
It may be a comment line like this which is inserted into the constructor of a
class wizard class:
myclass::myclass()
{
//{{AFX_DATA_INIT(C_pageWarrantyClaimEquipment)
// constructor initialization of member variables
//}}AFX_DATA_INIT
}
You may have copied these comments into a second constructor of your class.
Simply remove these AFX comments from your own function and the problem will go
away. If you add member variable using class wizard it will look for these
comment to position initialization code.
If it isn't this AFX comment it is another one similar to this. The point is,
you need to look for duplicate comment code( beginning with // AFX_).
Ed Lenox
-----From: Niels Ull Jacobsen
An "insert block" is a part of the program delimited by
the special comments that are ClassWizards delimiters in the format=20
//{{AFX_XXX(CSomeClass)
...
//}}AFX_XXX
There are various types of blocks - AFX_DATA_INIT, AFX_VIRTUAL,=20
AFX_MESSAGE_MAP etc.
These comments tell ClassWizard where it can safely add/modify code.
The error message seems to indicate that you have two identical blocks.
Try using Find in files to look for //{{AFX and see if any identical line=
s=20
turn up.
Niels Ull Jacobsen, Kr=FCger A/S (nuj@kruger.dk)
Everything stated herein is THE OFFICIAL POLICY of the entire Kruger=20
group and should be taken as legally binding in every respect.=20
Pigs will grow wings and fly.
Jon Meltzer/HHP/International Thomson Publishing
Monday, July 01, 1996
[Mini-digest: 2 responses]
I got this message a month ago, and thanks to the members of this list I was
able to fix the problem:
- Look through your .cpp file (and its assorted .h file) for more than one
occurrence of an //{{AFX_DATA_INIT block. That's a command to the ClassWiz ,
and if you have created source for a duplicate constructor by copying the
original and modifying it that's probably how it got there. Delete all but one
occurrence of //{{AFX_DATA_INIT and //}}AFX_DATA_INIT. You don't have to
delete any of your code.
Information on the ClassWiz commands is in the MFC Encyclopedia, under the
topic "ClassWizard: Special-Format Comment Sections". And. for any Microsoft
guys on this list, the "insert block " error message needs to be documented!
-----From: "Stew: Rob Stewart"
I had that problem in some inherited code. What it turned out to be was the
data member "initialization" block that starts with, "//{{AFX_DATA_INIT(,"
being in more than one constructor. (BTW, I put "initialization" in
quotation marks since these are assignments after the invocation of default
ctors, they are not initializations (which would appear in the
initialization list).
Robert Stewart | My opinions are usually my own.
Datalytics, Inc. | stew@datalytics.com
| http://www.datalytics.com
| Вернуться в корень Архива
|