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 之间的内存泄漏


基础教程推荐
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01
- 我有静态或动态 boost 库吗? 2021-01-01
- 常量变量在标题中不起作用 2021-01-01
- 如何检查GTK+3.0中的小部件类型? 2022-11-30
- 在 C++ 中计算滚动/移动平均值 2021-01-01
- C++结构和函数声明。为什么它不能编译? 2022-11-07
- 如何在 C++ 中初始化静态常量成员? 2022-01-01
- 这个宏可以转换成函数吗? 2022-01-01
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01