"A duplicate insert block exists for class......"的解决办法

本文介绍了一个关于 MFC 对话框中 ClassWizard 出现错误的问题及解决方法。错误原因是由于类向导在识别代码时遇到多个//{{ 标记导致。解决方式为删除多余的//{{ 标记。

测试代码:

 

新建一个MFC对话框时,添加一个构造函数:

1

 

再打开ClassWizard时,将会提示这个:

2

 

错误原因:

 

class wizard出错与c++语法出错没有关系,class wizard根据//{{来寻找插入函数的入口,所以,如果//{{出现的次数有多次,就出错了.


需要注意的是,几时是被注释掉的代码,对class wizard也有影响,虽然编译能通过.

 

解决办法:

 

删除上图中打横线的两行即可,并检查其他//{{ 开头的代码是否有多余~~

 

参见文章http://www.codeguru.com/forum/archive/index.php/t-112218.html

LiteDB.LiteException HResult=0x80131500 Message=Cannot insert duplicate key in unique index '_id'. The duplicate value is '5'. Source=LiteDB StackTrace: at LiteDB.Engine.IndexService.AddNode(CollectionIndex index, BsonValue key, PageAddress dataBlock, Byte insertLevels, IndexNode last) at LiteDB.Engine.IndexService.AddNode(CollectionIndex index, BsonValue key, PageAddress dataBlock, IndexNode last) at LiteDB.Engine.LiteEngine.InsertDocument(Snapshot snapshot, BsonDocument doc, BsonAutoId autoId, IndexService indexer, DataService data) at LiteDB.Engine.LiteEngine.<>c__DisplayClass7_0.<Insert>b__0(TransactionService transaction) at LiteDB.Engine.LiteEngine.AutoTransaction[T](Func`2 fn) at LiteDB.Engine.LiteEngine.Insert(String collection, IEnumerable`1 docs, BsonAutoId autoId) at LiteDB.LiteCollection`1.Insert(T entity) at WindowsFormsApp1.db_class.and_db(Int32 id, String name, Int32 age) in C:\Users\32449\source\repos\学习数据库()\WindowsFormsApp1\db_class.cs:line 26 at WindowsFormsApp1.Form1.button1_Click(Object sender, EventArgs e) in C:\Users\32449\source\repos\学习数据库()\WindowsFormsApp1\Form1.cs:line 22 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.F
最新发布
12-07
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

汪宁宇

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值