调试断言失败

罗阿

我正在使用Visual Studio 2010中集成的OpenCv编写c ++代码。

http://opencv-srf.blogspot.com/2013/06/load-display-image.html

但是当我运行代码时,出现了以下错误消息:

调试断言失败程序:... cuments \ visual studio 2010 \ Projects \ test1 \ x64 \ Debug \ test1.exe文件:f:\ dd \ vctools \ crt_bld \ self_64_amd64 \ crt \ src \ fopen.c行:54

表达式:(文件!= NULL)

有关程序如何导致断言失败的信息,请参见有关断言的Visual C ++文档。

这是我的代码:

#include "opencv2/highgui/highgui.hpp"
#include <iostream>

using namespace cv;
using namespace std;

int main()
{
    Mat im = imread("C:/Users/Ruaa/Pictures/aa.png");
    if (im.empty()) 
    {
        cout << "Cannot load image!" << endl;
        return -1;
    }
    imshow("Image", im);
    waitKey(0);
}


'test1.exe': Loaded 'C:\Users\Ruaa\Documents\Visual Studio 2010\Projects\test1\x64\Debug\test1.exe', Symbols loaded.
'test1.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
'test1.exe': Loaded 'C:\Windows\System32\kernel32.dll', Symbols loaded (source information stripped).
'test1.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Symbols loaded (source information stripped).
'test1.exe': Loaded 'C:\opencv1\opencv\build\x64\vc11\bin\opencv_core245d.dll', Cannot find or open the PDB file
'test1.exe': Loaded 'C:\Windows\System32\msvcp110d.dll', Symbols loaded (source information stripped).
'test1.exe': Loaded 'C:\Windows\System32\msvcr110d.dll', Symbols loaded (source information stripped).
'test1.exe': Loaded 'C:\opencv1\opencv\build\x64\vc11\bin\opencv_highgui245d.dll', Cannot find or open the PDB file
'test1.exe': Loaded 'C:\Windows\System32\user32.dll', Symbols loaded (source information stripped).
'test1.exe': Loaded 'C:\Windows\System32\gdi32.dll', Symbols loaded (source information stripped).
'test1.exe': Loaded 'C:\Windows\System32\lpk.dll', Symbols loaded (source information stripped).
'test1.exe': Loaded 'C:\Windows\System32\usp10.dll', Symbols loaded (source information stripped).
'test1.exe': Loaded 'C:\Windows\System32\msvcrt.dll', Symbols loaded (source information stripped).
'test1.exe': Loaded 'C:\Windows\System32\ole32.dll', Symbols loaded (source information stripped).
'test1.exe': Loaded 'C:\Windows\System32\rpcrt4.dll', Symbols loaded (source information stripped).
'test1.exe': Loaded 'C:\Windows\System32\oleaut32.dll', Symbols loaded (source information stripped).
'test1.exe': Loaded 'C:\Windows\System32\advapi32.dll', Symbols loaded (source information stripped).
'test1.exe': Loaded 'C:\Windows\System32\sechost.dll', Symbols loaded (source information stripped).
'test1.exe': Loaded 'C:\Windows\winsxs\amd64_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7600.16661_none_a44e1fc257f685f6\comctl32.dll', Symbols loaded (source information stripped).
'test1.exe': Loaded 'C:\Windows\System32\msvfw32.dll', Symbols loaded (source information stripped).
'test1.exe': Loaded 'C:\Windows\System32\winmm.dll', Symbols loaded (source information stripped).
'test1.exe': Loaded 'C:\Windows\System32\shell32.dll', Symbols loaded (source information stripped).
'test1.exe': Loaded 'C:\Windows\System32\shlwapi.dll', Symbols loaded (source information stripped).
'test1.exe': Loaded 'C:\Windows\System32\avifil32.dll', Symbols loaded (source information stripped).
'test1.exe': Loaded 'C:\Windows\System32\msacm32.dll', Symbols loaded (source information stripped).
'test1.exe': Loaded 'C:\Windows\System32\avicap32.dll', Symbols loaded (source information stripped).
'test1.exe': Loaded 'C:\Windows\System32\version.dll', Symbols loaded (source information stripped).
'test1.exe': Loaded 'C:\Windows\System32\msvcr100.dll', Symbols loaded.
'test1.exe': Loaded 'C:\Windows\System32\msvcp100.dll', Symbols loaded.
'test1.exe': Loaded 'C:\Windows\System32\imm32.dll', Symbols loaded (source information stripped).
'test1.exe': Loaded 'C:\Windows\System32\msctf.dll', Symbols loaded (source information stripped).
Debug Assertion Failed!

Program: ...cuments\visual studio 2010\Projects\test1\x64\Debug\test1.exe
File: f:\dd\vctools\crt_bld\self_64_amd64\crt\src\fopen.c
Line: 54

Expression: (file != NULL)

For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.

(Press Retry to debug the application)
'test1.exe': Loaded 'C:\Windows\System32\uxtheme.dll', Symbols loaded.
'test1.exe': Loaded 'C:\Windows\System32\dwmapi.dll', Symbols loaded (source information stripped).
'test1.exe': Loaded 'C:\Windows\System32\cryptbase.dll', Symbols loaded (source information stripped).
The program '[4984] test1.exe: Native' has exited with code 3 (0x3).

这是调用堆栈:

msvcr110d.dll!fopen()  + 0x23 bytes 
    opencv_highgui245d.dll!000007feea737ea8()   
    [Frames below may be incorrect and/or missing, no symbols loaded for opencv_highgui245d.dll]    
    opencv_highgui245d.dll!000007feea73a725()   
    opencv_highgui245d.dll!000007feea73a5f1()   
>   test1.exe!main()  Line 10 + 0x3d bytes  C++
    test1.exe!__tmainCRTStartup()  Line 555 + 0x19 bytes    C
    kernel32.dll!BaseThreadInitThunk()  + 0xd bytes 
    ntdll.dll!0000000077752ca1()    
安托万

您在这里有两个问题:

  1. 您的文件C:/Users/Ruaa/Pictures/aa.png不存在,请尝试使用现有文件
  2. 您可以使用OpenCV的lib的调试版本,d.lib/.dll文件末尾删除,例如opencv_highgui245d=> opencv_highgui245,这样可以防止断言,使其更快,并且您几乎不需要OpenCV进行调试

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

调试断言失败

来自分类Dev

调试断言失败

来自分类Dev

调试断言失败错误

来自分类Dev

错误调试断言失败

来自分类Dev

调试断言失败CDialog

来自分类Dev

调试断言失败:_CrtIsValidHeapPointer(block)

来自分类Dev

C程序调试断言失败

来自分类Dev

STL排序-调试断言失败

来自分类Dev

调试断言失败密码检查

来自分类Dev

断言本征调试模式失败

来自分类Dev

调试断言失败:无效的空指针

来自分类Dev

删除对象时调试断言失败

来自分类Dev

使用指针时调试断言失败

来自分类Dev

Visual Studio C ++:调试断言失败

来自分类Dev

创建对象时调试断言失败

来自分类Dev

调试断言失败VS2010

来自分类Dev

通过rgbConverted.cpp调试断言失败

来自分类Dev

使用 std::erase 调试断言失败

来自分类Dev

调试仅在未调试时失败的python unittest断言的策略

来自分类Dev

如何调试“调试断言失败。缓冲区太小”?

来自分类Dev

sprintf_s()失败,并出现“调试断言失败”错误

来自分类Dev

调试断言失败。C ++向量下标超出范围

来自分类Dev

调试断言失败!表达式:_pFirstBlock == pHead

来自分类Dev

调试断言失败!在人脸识别openCv的detectAndDisplay功能中

来自分类Dev

C ++映射lower_bound导致调试断言失败

来自分类Dev

调试断言失败。C ++向量下标超出范围

来自分类Dev

使用isdigit比较unicode时出现调试断言失败错误

来自分类Dev

调试断言失败:向量下标超出范围

来自分类Dev

访问DLL中的函数时出现调试断言失败错误