调试错误-R6025 纯虚函数调用(No virtual called)
Debug error - R6025 pure virtual function call (No virtual called)
我是 C++ 的新手,正在尝试阅读我在网上找到的一些 OpenCV 教程。我生成的代码与 Visual Studio 2013 中的代码完全相同,并且能够正确地 运行 代码。但是,我不断收到错误消息:
(Press Retry to debug the application) Debug Error!
Program:
...rface_Basics\x64\Debug\OpenCV_Basics_CPP_Interface_Basics.exe
R6025
- pure virtual function call
(Press Retry to debug the application)
我正在阅读有关纯虚函数的内容,听起来您至少必须声明一个虚函数才能发生此错误,这只会导致更多的混乱。下面是我的代码:
#include <opencv2\opencv.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
如果能帮助解决这个问题,我们将不胜感激。
使用导致问题的静态或全局垫。
I found the problem, in
> 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 中的一个开放缺陷(尚未修复)。
尝试将您打开的 CV 更新到最新版本,缺陷记录提到了部分修复,可能会帮助您解决这个问题。
Mat image;
Mat processedImage;
那个全局声明就是问题所在。通话
image.release();
processedImage.release();
在
之前
return 0;
主要是。这个问题似乎与最近的 opencv3.0 有关(我同时使用了 alpha 和 beta,以及 RC1 版本,他们没有给出任何此类错误)。
我是 C++ 的新手,正在尝试阅读我在网上找到的一些 OpenCV 教程。我生成的代码与 Visual Studio 2013 中的代码完全相同,并且能够正确地 运行 代码。但是,我不断收到错误消息:
(Press Retry to debug the application) Debug Error!
Program: ...rface_Basics\x64\Debug\OpenCV_Basics_CPP_Interface_Basics.exe
R6025 - pure virtual function call
(Press Retry to debug the application)
我正在阅读有关纯虚函数的内容,听起来您至少必须声明一个虚函数才能发生此错误,这只会导致更多的混乱。下面是我的代码:
#include <opencv2\opencv.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如果能帮助解决这个问题,我们将不胜感激。
使用导致问题的静态或全局垫。
I found the problem, in
> 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 中的一个开放缺陷(尚未修复)。 尝试将您打开的 CV 更新到最新版本,缺陷记录提到了部分修复,可能会帮助您解决这个问题。
Mat image;
Mat processedImage;
那个全局声明就是问题所在。通话
image.release();
processedImage.release();
在
之前 return 0;
主要是。这个问题似乎与最近的 opencv3.0 有关(我同时使用了 alpha 和 beta,以及 RC1 版本,他们没有给出任何此类错误)。