How to remove memory leaks between OpenCV 1.1 and MFC 6.0 without linking MFC as static library(如何在不将 MFC 链接为静态库的情况下消除 OpenCV 1.1 和 MFC 6.0 之间的内存泄漏)
问题描述
如果您曾经尝试将 MFC 和 OpenCV 一起使用,您会知道 这一点记录的问题.正如论坛所示,如果没有将 MFC 链接为静态库,使用 OpenCV 会产生内存泄漏.
If you ever tried to use MFC and OpenCV together, you would know this well documented problem. As the forum shows, without linking MFC as static library, using OpenCV creates memory leaks.
然而,一个人找到了解决这个问题的方法,方法是重新编译 OpenCV 并稍微更改代码.但它适用于 2.0 或更高版本.
A guy, however, found a way to resolve this problem by recompiling OpenCV with slightly changed code. But it was for 2.0 or later.
我想知道 OpenCV 1.0 或 1.1 是否有类似的方法.当然,这些版本中没有 system.cpp.有人试过吗?
I would like to know if there is a similar method for OpenCV 1.0 or 1.1. Of course, there is no system.cpp in those versions. Anybody tried this?
推荐答案
我没有要测试的 Visual Studio 6.0,但我在 Visual Studio 9 上遇到了这个问题,我所做的如下:
I don't have Visual Studio 6.0 to test on, but I had this problem on Visual Studio 9 and what I did was the following:
我去了 Project Properties/Linker/Input 并在 Delay Loaded DLLs 中添加了以下 DLL:
I went to Project Properties/Linker/Input and I added to the Delay Loaded DLLs the following DLLs:
opencv_core220d.dll;opencv_highgui220d.dll 在调试中
opencv_core220.dll;opencv_highgui220.dll 在发布中
我看到 Visual Studio 6.0 有这个选项.
这篇关于如何在不将 MFC 链接为静态库的情况下消除 OpenCV 1.1 和 MFC 6.0 之间的内存泄漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在不将 MFC 链接为静态库的情况下消除 OpenCV 1.1 和 MFC 6.0 之间的内存泄漏
基础教程推荐
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 初始化列表*参数*评估顺序 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- CString 到 char* 2021-01-01
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
