我实现在了一个类CLASS A,此类以CObject为基类,又以A为基为实现一个class B
有两个虚函数。没有在这些类中使用任何 动态内存分配。而且这些类是在动态库中实现的。
我现在在主程序中(单文档)用A *pA = new A 动态申请了A的对像然后立即删除 delete pA;
这两句紧挨着中间没有做任何事。但是就在删除的时候出错了。
出错信息如下。program:D:\lib\Myproject.exe;
File: dbgheap.c
Line:1011Expression: _CrtIsValiHeapPointer(pUserData)For information on how your program can cause an assertion failure, see the Visual C++
documentation on asserts另外。如共享动态库有时候不会错 和 用静态动态库会出错。
有两个虚函数。没有在这些类中使用任何 动态内存分配。而且这些类是在动态库中实现的。
我现在在主程序中(单文档)用A *pA = new A 动态申请了A的对像然后立即删除 delete pA;
这两句紧挨着中间没有做任何事。但是就在删除的时候出错了。
出错信息如下。program:D:\lib\Myproject.exe;
File: dbgheap.c
Line:1011Expression: _CrtIsValiHeapPointer(pUserData)For information on how your program can cause an assertion failure, see the Visual C++
documentation on asserts另外。如共享动态库有时候不会错 和 用静态动态库会出错。
如果是 不用动态申请直接说明一个对像也不会出错。
AFX_EXT_CLASS,用工具查看下先没理由用静态链接到MFC类库会出错啊哈哈,学习
修改方法
VC5.0及以后版本 主程序的 stdafx.h 中 #include <afxdocob.h>
在5.0以前的版本中。除了主程序的 stdafx.h 中 #include <afxdocob.h>
还要修改afxdocob.h 在其最后添加#ifdef _AFX_PACKING
#pragma pack(pop)
#endif
#pragma pack(pop)
#endif搂住 上边折断是什么意思?pop是什么?〉
-----------------------------------------------
MyCSDN 免费版 - CSDN离线数据浏览工具。
http://community.csdn.net/Expert/TopicView1.asp?id=4608614
早就知道了。已经给出了解决办法。