调试断言失败 [英] Debug asssertion failure
问题描述
之前我遇到了执行代码的问题。我尝试关闭DEP,它在发布模式下运行良好。但是在调试模式下,我在bartool.cpp文件中的Verify语句中看到断言失败。
I had problem executing the code before. I tried making the DEP off and it runs well in release mode. But in debug mode, i see assertion failure at Verify statement in bartool.cpp file.
BOOL CToolBar::AddReplaceBitmap(HBITMAP hbmImageWell)
{
// need complete bitmap size to determine number of images
BITMAP bitmap;
VERIFY(::GetObject(hbmImageWell, sizeof(BITMAP), &bitmap));
注意: - 我正在将代码从VS 2005迁移到VS 2015
Note:- I am migrating the code from VS 2005 to VS 2015
推荐答案
我之前执行代码时遇到问题。我尝试关闭DEP,它在发布模式下运行良好。但是在调试模式下,我在bartool.cpp文件中的Verify语句中看到断言失败。
I had problem executing the code before. I tried making the DEP off and it runs well in release mode. But in debug mode, i see assertion failure at Verify statement in bartool.cpp file.
BOOL CToolBar::AddReplaceBitmap(HBITMAP hbmImageWell)
{
// need complete bitmap size to determine number of images
BITMAP bitmap;
VERIFY(::GetObject(hbmImageWell, sizeof(BITMAP), &bitmap));
注意: - 我正在将代码从VS 2005迁移到VS 2015
Note:- I am migrating the code from VS 2005 to VS 2015
VERIFY会在调试模式下导致断言,但不会在释放模式下导致断言。
VERIFY causes an assert in debug mode, but not in release mode.
在调试器下运行调试版本,当断言到来时,查看调用堆栈以查看错误。
Run the debug version under the debugger and when the assert comes, look at the call stack to see what is wrong.
这篇关于调试断言失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!