vs2013利用mfc创建模态对话框时出现Debug Assertion Failed! 新手求解答

图片说明一直都是这个错误 不知道怎么办 求求各位大佬看看 万分感谢

1个回答

没有代码,鬼才知道什么问题。你应该用调试方式运行程序
看我的演示:
图片说明

程序里我故意写了一个除0的错误。
怎么找到呢?点开始调试(不要直接运行)
出错了点中断,自动停到错误的地方
一看就知道写错了。

oyjnjy
要好好加油啊 感谢感谢!!!
11 个月之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
vs2013利用mfc创建模态对话框时出现Debug Assertion Failed! 新手求解答
![图片说明](https://img-ask.csdn.net/upload/201811/01/1541073926_906226.png)一直都是这个错误 不知道怎么办 求求各位大佬看看 万分感谢
vs2013利用mfc创建模态对话框时出现Debug Assertion Failed
** vs2013利用mfc创建模态对话框时出现Debug Assertion Failed! 新手求解答 中断之后指向了这个语句 这个是什么情况? 新的改变 我们对Markdown编辑器进行了一些功能拓展与语法支持,除了标准的Markdown编辑器功能,我们增加了如下几点新功能,帮助你用它写博客: 全新的界面设计 ,将会带来全新的写作体验; 在创作中心设置你喜爱的代码高亮样式,Markdo...
MFC Debug Assertion Failed!
出错部分代码如下:rn[code=c]rnbool LinkLicenseServer()rnrn if(!AfxSocketInit())rn rn AfxMessageBox(L"Error 201:Socket Initial Failed!");rn return false;rn rn CClientSocket *clientSocket;rn clientSocket = new CClientSocket();rn clientSocket->AsyncSelect(FD_READ|FD_WRITE|FD_OOB); //在此弹出图片1和2rnrn CString m_strServer=LicenseIP;rn long licport = _wtol(LicensePort);rn if(!clientSocket->Create()) //在此第三张图片弹出两遍rn rn ::AfxMessageBox(L"Error 202:Connect to the License server failed!");rn return false;rn rnrn if(!clientSocket.Connect(m_strServer,licport))rn rn ::AfxMessageBox(L"Error 203:Connect to the License server failed!");rn return false;rn rn......rnrn[/code]rnCClientSocket 类rn[code=c]rn#include "StdAfx.h"rn#include "ClientSocket.h"rn#include "tagHeader.h"rnrn#ifdef _DEBUGrn#define new DEBUG_NEWrn#undef THIS_FILErnstatic char THIS_FILE[] = __FILE__;rn#endifrnrnCClientSocket::CClientSocket(void)rnrnrnrnrnCClientSocket::~CClientSocket(void)rnrnrnrnrnvoid CClientSocket::OnReceive(int nErrorCode) rnrn // TODO: Add your specialized code here and/or call the base classrn rn CString Msg;rn char buff[1000];rn memset(buff,0,sizeof(buff));rnrn Receive(buff, sizeof(buff),2); rn Msg =CString(buff).Mid(1);rn long t1=GetTickCount();rnrn while(Msg.GetLength()!=buff[0])rn rn long t2=GetTickCount();rn if((t2-t1)/1000>5)rn rn this->Close() ;rn return;rn rn Receive(buff, sizeof(buff),2); rn Msg =CString(buff).Mid(1);rn rn Receive(buff, sizeof(buff),0); rn receivecheck=Msg;rn isreceivecheck=true;rnrn CSocket::OnReceive(nErrorCode);rnrnrnrn[/code]rn图片1rn[img=https://img-bbs.csdn.net/upload/201310/29/1383033736_107690.png][/img]rn图片2rn[img=https://img-bbs.csdn.net/upload/201310/29/1383033759_181568.png][/img]rn图片3rn[img=https://img-bbs.csdn.net/upload/201310/29/1383033776_991922.png][/img]rnrn图1图2出错相关代码:rn[code=c]rnBOOL CAsyncSocket::AsyncSelect(long lEvent)rnrn ASSERT(m_hSocket != INVALID_SOCKET);//第386行rnrn _AFX_SOCK_THREAD_STATE* pState = _afxSockThreadState;rn ASSERT(pState->m_hSocketWindow != NULL);//第389行rnrn return WSAAsyncSelect(m_hSocket, pState->m_hSocketWindow,rn WM_SOCKET_NOTIFY, lEvent) != SOCKET_ERROR;rnrn[/code]rn图3出错相关代码rn[code=c]rn_AFXWIN_INLINE HINSTANCE AFXAPI AfxGetInstanceHandle()rn ASSERT(afxCurrentInstanceHandle != NULL);//第21行rn return afxCurrentInstanceHandle; rn[/code]
关于VS2013下的Debug Assertion Failed
写了一个简单的文字游戏,猜数字。电脑随机产生4个整型数字,玩家输入。玩家输入数字和电脑随机数对比,如果i个数字数字对吗,且位置对,几个数字数字对,位置不对,则输出iAjB。rn调试发现如下情况:rn[img=https://img-bbs.csdn.net/upload/201701/11/1484136399_74030.png][/img]rn提示如下:rn[img=https://img-bbs.csdn.net/upload/201701/11/1484136441_552606.png][/img]rn代码如下:rn#include rn#include rn#include rn#include rn#include rn#include rnrnint rand_num[4];//存放电脑随机产生的4位数rnrn/*创建4个随机数*/rnvoid make_rand_number(void)rnrn srand(time(0));rn for (int i = 0; i < 4; i++)rn rn rand_num[i] = rand() % 8;rn for (int j = i - 1; j >= 0; j--)rn rn if (rand_num[i] == rand_num[j])//有相同的则重新随机rn rn --i;rn rn rn rnrnrn/*判断输入数是否有输入错误,输入错误则返回0*/rnint judge(int judge_num)rnrn if (isalpha(judge_num))//是否输入为字母rn rn printf("can not input strings.\n");rn return 0;rn rn if (judge_num > 9999 || judge_num < 0)//是否大鱼9999或小于0rn rn printf("Error input.\n");rn return 0;rn rn return 1;rnrnrn/*比较输入与随机数*/rnint compare(int compare_num, int compare_array[4])rnrn int A_count = 0;rn int B_count = 0;rnrn for (int j = 3; j > -1; j--)rn rn for (int i = 0; i < 4; i++)rn rn if (compare_array[i] == ((int)compare_num / pow(10, j)))rn rn B_count++;rn if ((i + j) == 3)rn rn B_count--;rn A_count++;rn rn rn rn rn printf("%dA&dB", A_count, B_count);rn if (A_count == 4)rn return 1;rn elsern return 0;rnrnrn/*判断是再来一局游戏还是退出*/rnint AgOREx(void)rnrn printf("play again?(Y OR N):");rn char ch[2];rn while (1)rn rn scanf("%s", ch);rn if (strcmp(ch, "Y") == 0 || strcmp(ch, "y") == 0)rn return 1;rn else if (strcmp(ch, "N") == 0 || strcmp(ch, "n") == 0)rn return 0;rn elsern printf("\nError input.\n");rn rnrnrnrnvoid main(void)rnrnrn for (int i = 0; i < 2; i++)rn rn system("cls");rnrn printf("\t\t猜数字\n");rn printf("游戏规则:\n");rn printf("1.电脑将随机产生4为不同的数字(0-9),你需要输入4位数作为你的答案,输入完毕按回车键确认;\n");rn printf("2.如果1个数字猜对但位置不对,则返回提示1B;如果1个数字对了且位置对了,则返回1A(此时不算1B)\n例如:电脑随机数为2345,你输入为5621,则提示1A1B\n");rn printf("\n开始\n");rnrn make_rand_number();//创建随机数rn for (int j = 0; j < 2; j++)rn rn int input_num;rn printf("\n请输入猜测答案:");rn if (scanf("%d", &input_num) != 1)rn exit(0);rn int re_judge = judge(input_num);rn if (re_judge == 0)//判读输入有误,重新开始游戏rn rn i = 0;rn break;rn rn int compare_num = compare(input_num, rand_num[4]);rn if (compare_num == 0)//如果不是输出4A0B,则重新输入rn rn j = 0;rn rn rn int AgOREx_num = AgOREx();//4A0B后判断是否重新游戏rn if (AgOREx_num == 1)rn rn i = 0;rn rn else if (AgOREx_num == 0)rn rn i = 2;rn rn rn system("pause");rnrnrnrn求解释。rn
出现debug assertion failed?
[code=c]#includern#includernusing namespace std;rnstruct candyrnrn string brand;rn double weight;rn int calory;rn;rnint main()rnrn candy *snack=new candy[3];rn snack[0].brand="Macho Munch";rn snack[0].weight=2.3;rn snack[0].calory=350;rn snack[1].brand="Macho Munch";rn snack[1].weight=2.3;rn snack[1].calory=350;rn snack[2].brand="Macho Munch";rn snack[2].weight=2.3;rn snack[2].calory=350;rn for(int i=0;i<3;i++)rn rn cout<
MFC在debug模式下编译程序时出现了Debug Assertion Failed!
[img=https://img-bbs.csdn.net/upload/201410/05/1412441350_404305.png][/img]rn我写了个贪吃蛇程序,一开始是在debug下编译的,没问题,于是就切换到了release模式下生成了一个程序,之后感觉程序有点问题,就直接在release模式下把代码改了,并且运行成功了,然后我又转换到debug模式下,结果就出现了这个错误rn之后我设置了一些断点,发现程序是在运行到InitInstance()函数中的ShowWindow()函数时崩溃的。rn我想问的是:我后来改代码的时候跟这个函数一点关系没有为什么会在这个函数上崩溃?这个函数有什么特别之处吗?rn还是说我改完以后的代码本身就有问题?
MFC创建一个窗口,debug assertion failed
没接触过MFC,但是要用MFC创建个窗口,就在网上找了段代码rn[code=C/C++]rn class CFirstApp : public CWinApp rn rn public: rn virtual BOOL InitInstance(); rn ; rn class CFirstWindow : public CFrameWnd rn rn CStatic* cs; rn public: rn CFirstWindow(); rn ; rn rn // 每当应用程序首次执行时都要调用的初始化函数 rn BOOL CFirstApp::InitInstance() rn rn m_pMainWnd = new CFirstWindow(); rn m_pMainWnd->ShowWindow(m_nCmdShow); rn m_pMainWnd->UpdateWindow(); rn return TRUE; rn rn rn // 窗口类的构造函数 rn CFirstWindow::CFirstWindow() rn rn // 建立窗口本身 rn Create(NULL, rn _T("My first application"), rn WS_OVERLAPPEDWINDOW, rn CRect(0,0,200,200)); rn rn rn rn rn int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])rnrn CFirstApp FirstApp; rnrn[/code]rnrn运行时提示:debug assertion failedrn请问是怎么回事?谢谢.
对话框程序调试出现:debug assertion failed!
我写的一个MFC对话框程序,调试的时候就出现debug assertion failed!的提示,不知何解。拜托各位指点迷津!rn如下:rn Debug assertion failed!rn Program :D:\projects\RTC\Debug\RTC.exern File:afxwin1.inlrn Line:22
MFC创建非模态对话框的debug assertion failed问题
在MFC创建非模态对话框时,第一次点击菜单时可以生成一个非模态对话框,关闭以后第二次点击菜单时出现错误。 调试追踪问题: 首先如果是vc6的话:  1、按F5运行你的程序  2、在出错时,选择“重试”  3、按ALT+7调出“调用栈”窗口  4、双击从上往下的最近一个自己定义的函数,系统会自动把该函数所在的文件显示出来,此时程序暂停在光标处。一般来说错误就出在这附近。你可以通过查看变量
MFC出现Debug assertion failed问题
碰到一个问题,不明白错在哪里,请大神们指点一下!!!n程序目的是在主窗口触发某事件后,弹出新的窗口显示列表,不同事件列表内容不同程序大概框架如下:n在主窗口类中添加了公有成员变量m_DeviceDlg,它也是窗口类型,并且它包含一个列表控件(ListCtrl)n//主窗口类定义nclass CZigBeeHomeAutomationDesktopDlg : public CDialogExnn....npublic:n CDeviceListDlg m_DeviceDlg;n void CZigBeeHomeAutomationDesktopDlg::OnClickDeviceList(NMHDR *pNMHDR, LRESULT *pResult);n....nn//根据触发条件显示列表窗口nvoid CZigBeeHomeAutomationDesktopDlg::OnClickDeviceList(NMHDR *pNMHDR, LRESULT *pResult)nn....ncase ..:n m_DeviceDlg.LoadDeviceList(m_LockDeviceList, m_LockDeviceCount);n m_DeviceDlg.DoModal();ncase ..:n....nn//列表窗口类定义nclass CDeviceListDlg : public CDialogExnn...npublic:n CListCtrl m_TableList;n void LoadDeviceList(void);n...nn//用于重载列表控件以显示不同内容nvoid CDeviceListDlg::LoadDeviceList()nn....nDWORD dwStyle;ndwStyle = m_TableList.GetExtendedStyle();<----这里发生Debug assertion failednnm_TableList为什么不能用了呢?n
结束Dialog对话框时Debug Assertion Failed
在View中创建的NewDialog对象,DoModal()正常,在结束时(OK/CANCEL/直接关闭窗口)出现问题:rnDebug Assertion Failed!rn重载OnOK(),删掉CDialog::OnOK();,换成rnEndDialog(1);rn仍然还是Debug Assertion Failedrn请教大虾,代码如下:rn/////////////////CView.cpprnvoid COpenimage4View::On123() //一个菜单选项rnrn if(flag==0) //flag设为View成员,标志是否已经创建Dialog对象rn NewDialog newdialog;rn flag=1;rn newdialog.m_updata=0; //Dialog成员初始化rn newdialog.m_leftdata=0;rn newdialog.m_rightdata=0;rn newdialog.m_downdata=0;rn newdialog.DoModal(); rn newdialog.UpdateData(TRUE);rn rn elsern NewDialog* viewdialog=(NewDialog*)GetParent()->GetDlgItem(IDD_DIALOG1);rn viewdialog->DoModal();rn rnrn/////////////NewDialog.cpprnvoid NewDialog::OnOK() rnrn // TODO: Add extra validation herern EndDialog(1);rn //CDialog::OnOK();rn
新手求助: Debug Assertion Failed!
项目编译、链接成功,在运行时出现以下错误。rn我是初学者,很多都不懂。 rn请各位高手帮帮忙!(VC++6.0)rnrnDebug Assertion Failed!rnProgram:...\MP3player\\Debug\Top MP3player.exe rnFile:afxwin1.inl rnLine:820rnrnFor information on how your program can cause an assertion rnfsilure,see the Visual C++ documentation on asserts. rnrn
新手求分析debug assertion failed
[img=https://img-bbs.csdn.net/upload/201307/03/1372857211_720659.jpg][/img]rn[img=https://img-bbs.csdn.net/upload/201307/03/1372857219_679667.jpg][/img]rn运行MFC程序的时候出了这个问题,但是水平实在有限,不知为何。
mfc多线程debug assertion failed
[img=https://img-bbs.csdn.net/upload/201610/14/1476448934_199700.png][/img]rn上图是目标的ui界面,我想在前进的时候实现避障,所以用while语句写了个壁障程序,由于在主程序使用会造成程序无法停止,所以创建了另外一条线程进行壁障。rn[img=https://img-bbs.csdn.net/upload/201610/14/1476449216_472620.png][/img]rn[img=https://img-bbs.csdn.net/upload/201610/14/1476449228_438068.png][/img]rn声明了一个线程函数rn[img=https://img-bbs.csdn.net/upload/201610/14/1476449263_4300.png][/img]rn定义了一个全局变量rn[img=https://img-bbs.csdn.net/upload/201610/14/1476449307_793452.png][/img]rn这是一个简单的壁障程序,超声波检测的rn[img=https://img-bbs.csdn.net/upload/201610/14/1476449362_539673.png][/img]rn具体的线程函数定义rn[img=https://img-bbs.csdn.net/upload/201610/14/1476449399_200297.png][/img]rn前进键按下进去壁障线程rn[img=https://img-bbs.csdn.net/upload/201610/14/1476449436_281863.png][/img]rn停止键按下退出线程rn[img=https://img-bbs.csdn.net/upload/201610/14/1476449501_700704.png][/img]rn编译没问题,运行时一按前进键就崩溃rn[img=https://img-bbs.csdn.net/upload/201610/14/1476449681_194346.png][/img]rn调试的时候一到黄线部分就崩溃rn望各位大神不吝指教,在此拜谢!
mfc调试问题Debug Assertion Failed
我正在看《深入浅出mfc》遇到的问题rn在写scribble step1时,编译ok了但调试出问题了。。rn单击调试弹出的对话框是:rnDebug Assertion FailedrnrnFile:list_o.cpprnLine:196rn点retry后黄色箭头定位在如下函数》》处(in list_o.cpp)rnCObject* CObList::RemoveHead()rnrn ASSERT_VALID(this);rn 》》 ASSERT(m_pNodeHead != NULL); // don't call on empty list !!!rn ASSERT(AfxIsValidAddress(m_pNodeHead, sizeof(CNode)));rnrn CNode* pOldNode = m_pNodeHead;rn CObject* returnValue = pOldNode->data;rnrn m_pNodeHead = pOldNode->pNext;rn if (m_pNodeHead != NULL)rn m_pNodeHead->pPrev = NULL;rn elsern m_pNodeTail = NULL;rn FreeNode(pOldNode);rn return returnValue;rnrn最后通过单步调试,发现错误出现在如下文件的》》处,rnvoid CScribbleDoc::DeleteContents()rnrn while (!m_strokeList.IsEmpty());rn rn 》》 delete m_strokeList.RemoveHead();rn rn CDocument::DeleteContents();rnrn这到底是什么问题啊 小弟谢谢各位大哥大姐了 vc++有难度啊 要好好学啊 呵呵rnrn
求助!!MFC Debug Assertion Failed!
菜鸟求大神看看![img=https://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/001/face/36.gif][/img]万分感谢!!rn借用用了别人编写的一个MFC波形图控件,我编写了程序,编译无报错,但是运行后会有如下提醒:rnDebug Assertion Failed!rnrnProgram: C:\WINDOWS\SYSTEM32\mfc110ud.dllrnFile: f:\dd\vctools\vc7libs\ship\atlmfc\include\afxwin1.inlrnLine: 81rnrnFor information on how your program can cause an assertionrnfailure, see the Visual C++ documentation on asserts.rn我中断找到该位置:rn _AFXWIN_INLINE int CGdiObject::_AFX_FUNCNAME(GetObject)(int nCount, LPVOID lpObject) constrn-> ASSERT(m_hObject != NULL); return ::GetObject(m_hObject, nCount, lpObject); rn怎么解决这个问题啊!
删除对象时出现Debug Assertion Failed
[code=c]#include rnrnusing namespace std;rnrnclass Line rn private :rn double length;rn public :rn double getLen();rn void setLen(double length);rn Line(double length);rn ~Line()rn rn cout << "Object is delete . " << endl;rn rn;rnrnint main() rnrn Line line (10.00);rn cout << "Length of line : " << line.getLen() << endl;rn line.setLen(5.98);rn cout << "Cut to : " << line.getLen() << endl;rn Line line2(20.00);rn rn delete &line;rn delete &line2;rn system("pause");rn return 0;rnrnrninline double Line::getLen()rnrn return length;rnrnrninline void Line::setLen(double length)rnrn this->length = length;rnrnrninline Line::Line(double length)rnrn cout << "----------Create an line----------" << endl;rn this->length = length;rnrn[/code]rn运行时出错:rn[img=https://img-bbs.csdn.net/upload/201608/16/1471340958_19959.png][/img]rnrn初学C++ , 求解答
出现了debug assertion failed错误
谁能帮我看下代码?rn[code=C/C++]// GDItestView.cpp : implementation of the CGDItestView classrn//rnrn#include "stdafx.h"rn#include "GDItest.h"rnrnrn#include "GDItestDoc.h"rn#include "GDItestView.h"rn#include "InputDlg.h"rnrn#ifdef _DEBUGrn#define new DEBUG_NEWrn#undef THIS_FILErnstatic char THIS_FILE[] = __FILE__;rn#endifrnrntypedef structrn int weight;rn int parent,lchild,rchild;rnHTNode, *HuffmanTree; //动态分配数组存储哈夫曼树rnrnrnrnrn/////////////////////////////////////////////////////////////////////////////rn// CGDItestViewrnrnIMPLEMENT_DYNCREATE(CGDItestView, CView)rnrnBEGIN_MESSAGE_MAP(CGDItestView, CView)rn //AFX_MSG_MAP(CGDItestView)rn ON_COMMAND(IDM_CESHI, OnCeshi)rn ON_COMMAND(IDM_SAVE, OnSaveDlg)rn ON_BN_CLICKED(IDC_SAVE, OnSave)rn //AFX_MSG_MAPrn // Standard printing commandsrn ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)rn ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)rn ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)rnEND_MESSAGE_MAP()rnrn/////////////////////////////////////////////////////////////////////////////rn// CGDItestView construction/destructionrnrnCGDItestView::CGDItestView()rnrn // TODO: add construction code herern m_allnode = 0;rn m_leafnum = 0;rn i = 0;rn GetClientRect(&rect); //获取客户区大小rnrnrnCGDItestView::~CGDItestView()rnrnrnrnrnBOOL CGDItestView::PreCreateWindow(CREATESTRUCT& cs)rnrn // TODO: Modify the Window class or styles here by modifyingrn // the CREATESTRUCT csrnrn return CView::PreCreateWindow(cs);rnrnrn/////////////////////////////////////////////////////////////////////////////rn// CGDItestView drawingrnrnvoid CGDItestView::OnDraw(CDC* pDC)rnrn CGDItestDoc* pDoc = GetDocument();rn ASSERT_VALID(pDoc);rn // TODO: add draw code for native data herernrnrn/////////////////////////////////////////////////////////////////////////////rn// CGDItestView printingrnrnBOOL CGDItestView::OnPreparePrinting(CPrintInfo* pInfo)rnrn // default preparationrn return DoPreparePrinting(pInfo);rnrnrnvoid CGDItestView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)rnrn // TODO: add extra initialization before printingrnrnrnvoid CGDItestView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)rnrn // TODO: add cleanup after printingrnrnrn/////////////////////////////////////////////////////////////////////////////rn// CGDItestView diagnosticsrnrn#ifdef _DEBUGrnvoid CGDItestView::AssertValid() constrnrn CView::AssertValid();rnrnrnvoid CGDItestView::Dump(CDumpContext& dc) constrnrn CView::Dump(dc);rnrnrnCGDItestDoc* CGDItestView::GetDocument() // non-debug version is inlinernrn ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CGDItestDoc)));rn return (CGDItestDoc*)m_pDocument;rnrn#endif //_DEBUGrnrn/////////////////////////////////////////////////////////////////////////////rn// CGDItestView message handlersrnrnvoid CGDItestView::OnCeshi() //用作测试画笔、画刷等情况,此函数无其他意义rnrn // TODO: Add your command handler code herern CClientDC dc(this);rn CPen pen(PS_SOLID,5,RGB(255,0,0));rn dc.SelectObject(&pen);rn CBrush *pBrush=CBrush::FromHandle((HBRUSH)GetStockObject(NULL_BRUSH));rn dc.SelectObject(pBrush);rn dc.Ellipse(10,20,50,60);rn CString str="15";rn rn dc.TextOut(25,30,str);rnrnrnrnvoid CGDItestView::OnSaveDlg() rnrn // TODO: Add your command handler code herern CInputDlg *pDlg = new CInputDlg();rn pDlg->Create(IDD_SAVE,this);rn pDlg->ShowWindow(SW_SHOW);rnrnrnvoid CGDItestView::OnSave() rnrn // TODO: Add your control notification handler code herern// static CInputDlg Dlg;rn// m_leafnum = Dlg.leafnum;rn// m_allnode = 2 * m_leafnum - 1;rnrn m_leafnum = this->GetDlgItemInt(IDC_LEAFNUM); //获取叶子数rn m_allnode = 2 * m_leafnum - 1; //构成哈夫曼树节点总数rn static HuffmanTree HT = (HuffmanTree)malloc((m_allnode + 1) * sizeof(HTNode)); //0号单元未用rn// static HTNode *HT = new HTNode[(m_allnode + 1) * sizeof(HTNode)];rn //初始化叶子结点rn i++;rn// HT[i].weight = Dlg.leafdata;rn HT[i].weight = this->GetDlgItemInt(IDC_LEAFDATA);rn HT[i].lchild = 0;rn HT[i].rchild = 0;rn HT[i].parent = 0;rn //定义画笔、画刷绘图rn CClientDC dc(this);rn CPen pen(PS_SOLID,5,RGB(255,0,0));rn dc.SelectObject(&pen);rn CBrush *pBrush=CBrush::FromHandle((HBRUSH)GetStockObject(NULL_BRUSH));rn dc.SelectObject(pBrush);rn dc.Ellipse(rect.right / m_leafnum * (i - 1),rect.bottom - (rect.bottom / m_leafnum),rect.right / m_leafnum * i,rect.bottom);rn rn CString str;rn itoa(HT[i].weight,(char*)&str,10);rn dc.TextOut(rect.right / m_leafnum * (i - 1)+(rect.right / m_leafnum) / 2,rect.bottom - (rect.bottom / m_leafnum)+(rect.bottom / m_leafnum) / 2,str); rnrn[/code]
■■■非模态属性页,Debug Assertion Failed!
我想做一个非模态的属性页,不知如何却怎么也显示不出来,总是提示 rnDebug Assertion Failed!rnrn请大虾指点,代码如下:rnrnint CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)rnrn //.......rnrnrn // TODO: Delete these three lines if you don't want the toolbar torn // be dockablern m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);rn EnableDocking(CBRS_ALIGN_ANY);rn DockControlBar(&m_wndToolBar); rnrn m_wndProperty.Create();rn pm_wndColorPage=new CColorPage();rn pm_wndEditorPage=new CMyEditorPage();rn m_wndProperty.AddPage(pm_wndColorPage);rn m_wndProperty.AddPage(pm_wndEditorPage);rn //m_wndProperty.ShowWindow(SW_SHOW); //这句取消注释,运行就Debug Asseration failed!rn rn return 0;rn
MFC程序调试时出现debug assertion failed line 146
具体显示如下rnrnfail f:\dd\vctools\vc7libs\ship\atlmfc\include\afxwin2.inl rnline:146rnrn各位大侠,能告诉我是怎么回事吗?
用vs2010 编写MFC时出现error:debug assertion failed
[code=c]void popoutmaindlg()rnrn // TODO: 在此添加控件通知处理程序代码rn AFX_MANAGE_STATE(AfxGetStaticModuleState());rn MainFrame dlg;rn dlg.DoModal();rn return;rn[/code]rn其实就是一段简单的程序,已经找到错误原因:多了这句AFX_MANAGE_STATE(AfxGetStaticModuleState());rn注释掉就好了,有点搞不懂啊,前面貌似看到大神说这个很重要的。麻烦说下重要不
Debug Assertion Failed !
我这几天做一个小程序,主要是显示位图,主窗体是用CFormView ,开始我只是打开显示一个位图(正常), 后来我在CXXXView::OnInitialUpdate()里加入m_yc.Create(IDD_LEFT_FORM,this) 其中m_yc是一个CDialog类型的(对应的对话框是IDD_LEFT_FORM ,我加入这个Child Style的对话框是想在主窗体的左边出现IDD_LEFT_FORM)。 编译通过程序初始化也正常,但是在打开位图时出问题了:位图可以显示,但出现Debug Assertion Failed !对话框,说是wincore.exe错误,在第639行:rnBOOL AFXAPI AfxUnhookWindowCreate()rnrn _AFX_THREAD_STATE* pThreadState = _afxThreadState.GetData();rn#ifndef _AFXDLLrn if (afxContextIsDLL && pThreadState->m_hHookOldCbtFilter != NULL)rn rn ::UnhookWindowsHookEx(pThreadState->m_hHookOldCbtFilter);rn pThreadState->m_hHookOldCbtFilter = NULL;//本行出错!!!rn rn#endifrn if (pThreadState->m_pWndInit != NULL)rn rn pThreadState->m_pWndInit = NULL;rn return FALSE; // was not successfully hookedrn rn return TRUE;rnrnrn这是怎么一回事哦?? 大家帮帮忙
Debug Assertion Failed错误?
我是VC菜鸟,用F5调试时,执行中出现一个提示框:rnrnDebug Assertion FailedrnrnFile: dbgheap.crnLine 1017rnrn.....rnrn原因是什么
Debug Assertion Failed!问题
我按照书上的例子把程序做好rn运行的时候出现Debug Assertion Failed!rn我无法做出对应的解决方案rn请高手出马rn
Debug Assertion Failed什么意思?
在调试一个程序的时候,没有语法错误,执行后就跳出对话框来说:Debug Assertion Failed,怎样才能避免?rnrn我的程序如下:rnrn//BinaryTree.hrn // 二叉树类 //rn#includernusing namespace std;rnrntemplate class BinaryTree;rnrntemplate class BinTreeNodernrn friend class BinaryTree;rn public:rn BinTreeNode():LeftChild(NULL),RightChild(NULL)rn rn BinTreeNode( T Item,BinTreeNode* Left=NULL,BinTreeNode* Right=NULL):Data(Item),LeftChild(Left),RightChild(Right)rn rn T GetData() const rn rn return Data;rn rn BinTreeNode* GetLeft() const rn rn return LeftChild;rn rn BinTreeNode* GetRight() const rn rn return RightChild;rn rn void SetData(const T& Item)rn rn Data=Item;rn rn void SetLeft(BinTreeNode* L)rn rn LeftChild=L;rn rn void SetRight(BinTreeNode* R)rn rn RightChild=L;rn rn private:rn BinTreeNode* LeftChild, * RightChild;rn T Data;rn;rnrntemplate class BinaryTreernrn public:rn BinaryTree():Root(NULL)rn rn BinaryTree(T Value):RefValue(Value),Root(NULL)rn rn virtual ~BinaryTree()rn rn Destroy(Root);rn rn virtual int IsEmpty()rn rn return Root==NULL?1:0;rn rn virtual BinTreeNode *LeftChild(BinTreeNode* Current)rn rn return Root!=NULL?Current->LeftChild:NULL;rn rn virtual BinTreeNode *RightChild(BinTreeNode* Current)rn rn return Root!=NULL?Current->RightChild:NULL;rn rn const BinTreeNode* GetRoot() constrn rn return Root;rn rn void SetRoot(BinTreeNode* TheRoot)rn rn Root=TheRoot;rn rn private:rn BinTreeNode *Root;rn T RefValue;rn BinTreeNode* Parent(BinTreeNode* Start,BinTreeNode *Current);rn void Destroy(BinTreeNode* Current);rn;rnrntemplatevoid BinaryTree::Destroy(BinTreeNode* Current)rnrn if (Current!=NULL)rn rn Destroy(Current->LeftChild);rn Destroy(Current->RightChild);rn delete Current;rn rnrnrntemplate BinTreeNode* BinaryTree::Parent(BinTreeNode* Start,BinTreeNode *Current)rnrn if(Start==NULL) return NULL;rn if(Start->LeftChild==Current|| Start->RightChild==Current)rn return Start;rn BinTreeNode* p;rn if ((p=Parent(Start->LeftChild,Current))!=NULL)rn return p;rn else return Parent(Start->RightChild,Current);rnrnrn//Main.cpprnrn#include rn#include "BinaryTree.h"rn//using namespace std;rnrnvoid main()rnrn BinTreeNode TestNode;rn BinTreeNode Test2Node;rn BinTreeNode* pNode;rn BinaryTree TestTree; rnrn Test2Node.SetData(3);rn TestNode.SetData(8);rn TestNode.SetLeft(&Test2Node);rn pNode=&TestNode;rn TestTree.SetRoot(pNode);rnrn cout<GetData()<
Debug Assertion Failed!错误
编译时出现以下错误:rnrnDebug Assertion Failed!rnProgram:.... am Files\microsoft visuall studio\MyProjects\Pwd\Debug\pwd.exernrnfile:dlgData.cpprnLine:624rnFor information on how your program can cause an asserttion failure,see the visual c++ documentattion on asserts.rn(press retry to debugy the applicatio)rnrn以上是弹出对话框的内容,以下是源程序的一部分.rn这是什么问题,怎么解决???
Debug Assertion Failed错误
[code=C/C++][/code]rn#includernusing namespace std;rn//利用附加数组重排数组元素rntemplaternvoid Rearrange(T *&a, int n, int r[])rn//按序重排数组a中的元素,使用附加数组urn T *u = new T[n+1];rn //在u中移动到正确的位置rn for (int i=0; irnvoid Rank(T a[], int n, int r[])rn// Rank the n elements a[0:n-1].rn for (int i = 0; i < n; i++)rn r[i] = 0; // initializern // compare all element pairsrn // Visual complains if we say int i againrn for (int i = 1; i < n; i++)rn rn for (int j = 0; j < i; j++)rn rn if (a[j] <= a[i]) r[i]++;rn else r[j]++;rn rn rn;rnrn//Swap函数rntemplaterninline void Swap(T&a, T&b)rn rn T temp = a;rn a = b;rn b = temp;rn;rn//主函数rnvoid main()rnrn int n = 5;rn int *x = new int[5];rn int y[5] = 5, 9, 2, 7, 0;rn for (int i=0; i
Debug Assertion Failed!错误问题
写了一个网络捕包的小程序,在vc6.0 运行正常,在2005下出错,编译没有问题,运行中弹出对话框rn错误如下,rn Debug Assertion Failedrn file:isctype.crn line:56rn Expression:(unsinged)(c+1)<=256rnrn应该是由于网络包中 的不可打印字符造成的,在程序中用“.”代替不可打印字符,在报错后单击rn错误框中的忽略,屏幕是可以打印“.”的。但是几乎每到一个“.”的地方都会报错。rnrn程序中处理 不可打印字符的函数如下:rnrn[code=C/C++]rnchar ascii_string[10000];rnrnchar *char_to_ascii(char ch);rn//读取并分析获取的ASCII字符串内容rnchar * char_to_ascii(char ch)rn/* 此函数的功能主要用于把协议数据进行显示 */rnrn char *string;rn ascii_string[0] = 0;rn string = ascii_string;rn if (isgraph(ch))rn /* 可打印字符 */rn rn *string++ = ch;rn rn else if (ch == ' ')rn /* 空格 */rn rn *string++ = ch;rn rn else if (ch == '\n' || ch == '\r')rn /* 回车和换行 */rn rn *string++ = ch;rn rn elsern /* 其它字符以点"."表示 */rn rn *string++ = '.';rn rn *string = 0;rn return ascii_string;rnrn[/code]rn问题:rn1. vc2005中的判断可打印字符的函数是否为isgraph?rn2. vc2005中如何正确显示网络包中的数据?rn谢谢rnrn
Debug Assertion Failed 问题?
在vc中我做了一个界面,只想把表中的字段用编辑框显示出来,点击Adodc控件的下条记录,上条记录等就能讲表中的字段显示在相应的编辑框中,我不知道要在哪里写代码,就写在MoveComplete事件里,不知道对不对,运行后出现这样的错误框rn显示Debug Assertion Failed 错误,我是新手,不知道要怎么解决,求大家帮下忙!rnrnvoid CDeptDlg::OnMoveCompleteAdodc1(long adReason, LPDISPATCH pError, long FAR* adStatus, LPDISPATCH pRecordset) rn_RecordsetPtr m_pRecordset;rn rn m_pRecordset.CreateInstance(__uuidof(Recordset)); //创建RecordSet实例rn pRecordset->QueryInterface(IID_IDispatch, (void **)&m_pRecordset);rn if(! m_pRecordset->adoEOF)rn rn m_DeptId=m_DataGrid.GetItem(0);rn m_DeptName=m_DataGrid.GetItem(1);rn UpdateData(FALSE);rn rn else rn m_pRecordset->MoveFirst();rn while (!m_pRecordset->adoEOF)rn rn m_DeptId=m_DataGrid.GetItem(0);rn m_DeptName=m_DataGrid.GetItem(1);rn UpdateData(FALSE);rn rn
Debug Assertion Failed!
fputc的参数传递有问题,不知道怎么改,还望各位指点不胜感激rn[img=https://img-bbs.csdn.net/upload/201605/19/1463635273_367811.png][/img][img=https://img-bbs.csdn.net/upload/201605/19/1463635442_654717.png][/img]
关于Debug Assertion Failed
[img=https://img-bbs.csdn.net/upload/201410/02/1412232023_453340.png][/img]rnvs212 mfc编程,应该是数据库导入和指针的问题(我猜的)rn1.我先在stdafx.h中添加如下代码rn#import "C:\Program Files\Common Files\System\ado\msado15.dll" rename("EOF","adoEOF")rename("BOF","adoBOF")rnusing namespace ADODB;rn这步貌似没问题rn2.需要将_ConnectionPtr m_pConnection;_RecordsetPtr m_pRecordset;这两个指针添加到对应的dlg.h的类中rn因为我建立的是单文档的应用,所以我是将这两个指针放入该界面的头文件中了rn3.将如下代码放入初始化函数中,rn if(!AfxOleInit())rn rn rn try rn rn m_pConnection.CreateInstance(__uuidof(Connection)); rn m_pConnection->Open("Provider=SQLOLEDB;server=LEE-PC;Uid=sa;Pwd=110410322li;Database=MAF","","",adModeUnknown);rn rn catch(_com_error e) rn rn AfxMessageBox(e.Description()); rn rnrnrn运行时,进行到用到数据库的地方就出现如图的Debug Assertion Failedrn感觉是不是2,3步代码放的文件的位置不对?
Debug Assertion Failed
如题,一般是什么问题?如何解决?谢谢
vs2008 debug assertion failed
[img=http://img.my.csdn.net/uploads/201211/14/1352857313_8587.jpg][/img]rn重试中断,显示出错位置在这rn[img=http://img.my.csdn.net/uploads/201211/14/1352857227_3586.jpg][/img]rn昨天还可以的,今天就不行了,不知道为什么,求高手指点rnrn
Debug Assertion Failed请教
我编写了一个udp接收程序,编译通过了,点击发送按钮后出现Debug Assertion Failed错误,filecore.cpp line 342rnvoid CFile::SetLength(DWORD dwNewLen)rnrn ASSERT_VALID(this);rn [color=#FF0000]ASSERT(m_hFile != (UINT)hFileNull);[/color]rnrn Seek((LONG)dwNewLen, (UINT)begin);rnrn if (!::SetEndOfFile((HANDLE)m_hFile))rn CFileException::ThrowOsError((LONG)::GetLastError());rnrn就是红色标记的那一行出了错误,请问该怎么解决呢
Debug Assertion Failed!!!
我用视频编解码器.exe 执行文件,解码一个视频文件时,也就播放了2,3秒就报出这个错误了。rnDebug Assertion Failed!rnprogram :。。。。。。\ \\\视频编解码器.exe rnFile:dbgheap.crnLine:1044rnExpression:_CrtIsValidHeapPointer(pUserData)rnrnFor information on how your program can cause an assertion failure,see the Visual C++ documentation on assert。该窗口下面有两个按钮 终止 调试 。rnrnrn之后马上弹出一个标题为“应用程序错误”的窗口。显示内容如下:rn 应用程序发生异常 unknown software exception(0x80000003),位置为0x7c92120e.rn要终止程序,请单击“确定”。rn要调试程序,请单击“取消”。rnrn希望遇到过类似错误的朋友帮忙解答下,我不知道如何改正,找到了dbgheap.C文件,不懂错在那里???
Debug Assertion Failed! afxcoll.inl
Program: *.exernFile: afxcoll.inlrnLine: 319rnrnrn不知道是错在哪里。。。请教各位大虾~~
debug assertion failed
vc6调试程序跳出此框,file:afxwin1.inl,line : 22
关于Debug Assertion Failed!
#includern#includern#includernrn#define filename (c:\\zj.txt) //文件位置 rn#define N 100 //最大员工数 rntypedef struct memberrnrn char name[20];rn int no;rn char sex[10];rn char birthday[30];rn char marry[10];rn int child; rnST;rnST jober[N]; //公会成员rnrn/************************************rn 登陆函数rn*************************************/ rnvoid login()rnrn char password[20] , username[20];rn char name[20] , word[20];rn int flag = 0;rn FILE *fp = NULL;rn if( NULL == (fp=fopen("c:\\zj.txt","rb+")) )rn rn printf("不能打开文件请查找C盘根目录下是否有zj.txt!");rn getchar();rn exit(1);rn rn fread(username,sizeof(username),1,fp);rn fread(password,sizeof(password),1,fp);rn printf("请输入用户名和密码并用空格隔开(默认用户名密码admin admin):");rn while(flag < 3)rn rn scanf("%s %s",&name[0],&word[0]);rn if(strcmp(username,name) == 0 && strcmp(password,word) == 0)rn break;rn elsern rn printf("用户名或密码错误请重新输入:");rn flag++; rn rn rn fclose(fp);rn fp = NULL;rn if(flag>2)rn rn printf("密码错误次数过多 退出系统!!!");rn getchar();rn getchar();rn exit(1);rn rnrnrn/************************************rn 函数声明区rn************************************/rnvoid input(ST *a);rnint select();rnvoid pandect();rnrnint main(void)rn rn int x = 0; rn login();rn while(1)rn rn printf("\n*******************************************\n");rn printf("* *\n");rn printf("* 欢迎进入公会成员管理系统 *\n");rn printf("* *\n"); rn printf("* 请选择您需要的功能 *\n");rn printf("* 1:工会成员信息录入 *\n");rn printf("* 2:工会成员浏览 *\n");rn printf("* 3:查询工会成员信息 *\n");rn printf("* 4:工会成员信息删除 *\n");rn printf("* 5:工会成员信息修改 *\n");rn printf("* 6:修改密码 *\n");rn printf("* 7:退出程序 *\n");rn printf("* *\n");rn printf("*******************************************\n");rn scanf_s("%d",&x,1);rn switch(x)rn rn case 1: input(jober); break;rn case 2: pandect(); break;rn case 3: ;break;rn case 4: ;break;rn case 5: ;break;rn case 6: ;break;rn case 7:exit(1);break;rn default: ;break;rn rn rn rnreturn 0;rnrn/***********************rn 选择Y / Nrn 返回值0或者1rn************************/rnint select()rnrn char tmp;rn scanf("%c",&tmp);rn if(tmp == 89 || tmp == 67)rn return 1;rn else if(tmp == 78 || tmp == 46)rn return 0;rn elsern rn printf("输入错误 请重新输入!!!");rn select();rn rnrnrn/************************rn 信息录入rn*************************/rnvoid input(ST *a)rnrn FILE *fp = NULL;rn int x = 1;rn fp=fopen("c:\\zj.txt","ab+");rn while(x)rn rn printf("请输入成员姓名,工号,性别,生日,婚否,子女数 并用空格隔开:");rn printf("\n ");rn scanf("%s %d %s %s %s %d",a->name,&(a->no),a->sex,a->birthday,a->marry,&(a->child));rn fwrite(a,sizeof(ST),1,fp);rn printf("请问还需要录入吗? Y/N :");rn printf("\n");rn x = select();rn rn fclose(fp);rn fp = NULL;rnrnrn/************************rn 信息总览rn************************/rnvoid pandect()rnrn FILE *fp = NULL;rn int x = 0;long t;rn fp = fopen("c:\\zj.txt","rb+");rn fseek(fp,0L,2);rn t = ftell(fp);rn rewind(fp);rn t = t/sizeof(ST);rn printf("公会成员数:%d\n",t);rn fseek(fp,40L,0);rn fread(jober,sizeof(ST),100,fp);rn while(x < t)rn rn printf("姓名:%s 工号:%d 性别:%s \n生日:%s 婚否:%s 子女数:%d \n",jober[x].name,jober[x].no,jober[x].sex,jober[x].birthday,jober[x].marry,jober[x].child);rn printf("\n");rn x++;rn fclose(fp);rn fp = NULL;rn rn
Debug Assertion Failed问题
Debug Assertion Failedrnd:\programe\^^^^^rnFILE afx.inlrnLINE 177rnrn对应的代码rn_AFX_INLINE TCHAR CString::operator[](int nIndex)constrnrnASSERT(nIndex>=0);rnASSERT(nIndex<+GetData()->nDataLength);rnreturn m_pchData[nIndex];rnrn如何解决.高手指点.rnrn
Debug Assertion Failed!
用VS2008编译,,出错!新手,大家不吝指教啊rnrnrnProgram:f;\VS\Convolution_first\Debug\Convolution_first.exernFile: f:\dd\vctools\crt_bld\self_x86\crt\src\fprintf.crnLine:55rnrnrnExpression:(str!=NULL)rnrnFor information on how your program can cause assertion failure,see the Visual C++ documentation on asserts.rnrnrn我的主函数:rn#include "head.h"rnrnrn int Message0[(L+m)];rn int Message1[(L+m)];rn int Encoded0[(L+m)];rn int Encoded1[(L+m)];rn int Encoded2[(L+m)];rnrn int Transmitted0[(L+m)];rn int Transmitted1[(L+m)];rn int Transmitted2[(L+m)];rnrn double Received0[(L+m)];rn double Received1[(L+m)];rn double Received2[(L+m)];rnrn int Output0[(L+m)];rn int Output1[(L+m)];rn int Output2[(L+m)];rnrn int Decoded0[(L+m)];rn int Decoded1[(L+m)];rn rnrn int Trellis_next[8][4],Trellis_current[8][4], Trellis_Code[8][4];rn double SIGMA;rn double BER;rnchar name[80]="CON.dat";rnFILE *fp;rnint state=(int)time(NULL);rnrnint main()rnrn srand((unsigned)time(NULL)); rn fp=fopen(name,"w");rnrn fprintf(fp," EbNo BER\n");rn rn //int total_num;rn int i;rn int error_frame;rn int total_num;rn double EbNo,No;rn unsigned int errbit;rnrn rn for(EbNo=INIT;EbNo!=FINAL+1;EbNo+=SNRINC) //set Eb=1;rn rn errbit =0;rn error_frame=0;rn total_num =0;rn No =1.0/pow(10.0,EbNo/10.0);rn SIGMA =sqrt(No/2);rn rn while(error_frame
相关热词 c#入门推荐书 c# 解码海康数据流 c# xml的遍历循环 c# 取 查看源码没有的 c#解决高并发 委托 c#日期转化为字符串 c# 显示问号 c# 字典对象池 c#5.0 安装程序 c# 分页算法