跳转到内容
新建笔记

Debug Assertion Failed!Program.Expression:vector subscript out of rangeFor information on how your

1.野指针;2.内存泄露

Debug Assertion Failed!
Program:
…dSeg_Yolo_RT_vscode\build\x64-debug\THREAD_YOLO_RT_VSCODE.e
xe
File:D:\Program Files\Microsoft Visual
Studio\2022\Enterprise\VC\Tools\MSVC\14.40.33807\include\vector
Line:1890
Expression:vector subscript out of range
For information on how your program can cause an assertion
failure,see the Visual C++documentation on asserts.
(Press Retry to debug the application)

调试过程:

调试方式1,直接使用vs调试,显示堆栈调到,出错代码,方便省事。

调试方式2,使用gdb调试,run-bt-list查看出错附近程序。

在调试后发现:

yolov8 = new YOLO(modelFilePath.toStdString()); // 实例化YOLO对象
yolov8->make_pipe(true); // 少了此处代码

修改后,即可正常。


来源:CSDN 原文,首次发布于 2024-07-05。