调试错误-R6025纯虚拟函数调用(未调用虚拟函数)
Debug error - R6025 pure virtual function call (No virtual called)
我是C++的新手,正在尝试学习我在网上找到的一些OpenCV教程。我生成的代码与Visual Studio 2013中的代码完全一样,并且能够正确运行代码。然而,我不断得到一个错误:
(按"重试"调试应用程序(调试错误!
程序:…rface_Basics\x64\Debug\OpenCV_Basics_PP_Interface_Basics.exe
R6025-纯虚拟函数调用
(按"重试"调试应用程序(
我读到了关于纯虚拟函数的文章,听起来你至少必须声明一个虚拟函数才能发生这个错误,这只会导致更多的混乱。以下是我的代码:
#include <opencv2opencv.hpp>
#include <iostream>
using namespace cv;
using namespace std;
//main functions
void processImage();
void displayGraphics();
//images
Mat image;
Mat processedImage;
int main(int argc, char *argv[])
{
//create a window
namedWindow("Image");
namedWindow("ProcessedImage");
//load the image
if (argc > 1)
image = imread(argv[1]);
else
image = imread("lena.jpg");
if (image.empty())
exit(1);
processImage();
displayGraphics();
waitKey(0);
return 0;
}
void displayGraphics()
{
//display both images
imshow("Image", image);
imshow("ProcessedImage", processedImage);
}
void processImage()
{
int x, y;
Vec3b pixel;
unsigned char R, G, B;
processedImage = image.clone();
for (y = 0; y < processedImage.rows; y++)
{
for (x = 0; x < processedImage.cols; x++)
{
// Get the pixel at (x,y)
pixel = processedImage.at<Vec3b>(y, x);
// Get the separate colors
B = pixel[0];
G = pixel[1];
R = pixel[2];
// Assign the complement of each color
pixel[0] = 255 - B;
pixel[1] = 255 - G;
pixel[2] = 255 - R;
// Write the pixel back to the image
processedImage.at<Vec3b>(y, x) = pixel;
}
}
}
我已经尝试从主函数中删除参数,并完成上面引用的调试过程。然而,它只是调用这个crt0msg.c文件,并突出显示#ifdef_DEBUG部分的事例1。
如果能为解决这一问题提供任何帮助,我们将不胜感激。
使用导致问题的静态或全局Mat。
我在中发现了问题
> MatAllocator* Mat::getStdAllocator() {
> static StdMatAllocator allocator;//it's static. but mat's destructor need >it. so when that's have a static or global mat, can not be guaranteed this >allocator's destructor after that static or global mat.
> return allocator;
> }
来源:http://code.opencv.org/issues/3355
这是OpenCV中的一个公开缺陷(尚未修复(。试着将你打开的简历更新到最新版本,缺陷记录中提到了部分修复,可能会帮助你克服这个问题。
Mat image;
Mat processedImage;
这一全球宣言就是问题所在。呼叫
image.release();
processedImage.release();
之前
return 0;
总的来说。这个问题似乎与最近的opencv3.0有关(我使用了alpha和beta版本,以及RC1版本,他们没有给出任何这样的错误(。
相关文章:
- 如果整个应用程序是虚拟映射的,为什么 new 会进行系统调用?
- 当覆盖存在时调用基本虚拟"binded to object"函数
- C++ DLL 类导出、编译器"optimizes"虚拟调用
- 类型擦除的std::function与虚拟函数调用的开销
- 虚拟继承中来自基数的虚拟调用
- 通过在基类中虚拟调用派生类中的函数来访问派生类中的函数
- C++虚拟函数是正常调用还是虚拟调用
- 为什么C++虚拟调用并不比非虚拟调用慢多少
- 避免虚拟调用循环的模式
- C++11 标准::功能比虚拟调用慢
- 构造函数中的虚拟调用
- 为什么C++虚拟调用的成本取决于派生类的数量
- 为什么从构造函数对纯虚函数的虚拟调用是 UB,而标准允许调用非纯虚函数
- 优化后的虚拟调用成本
- 对于C++基类来说,存储"this"的值以供构造后的未来虚拟调用安全吗?
- 构造/销毁期间的虚拟调用
- 用FlasCC编译的c++程序使用-O4 (LTO)挂起虚拟调用
- 基构造函数中的 C++/CX 委托失败,并出现纯虚拟调用断言
- 如何将虚拟调用从未模板化的父级干净地分派到模板化的子级
- std::绑定和对基类方法的非虚拟调用