OpenCV 2.4.2 编译"operations.hpp"问题

OpenCV 2.4.2 Compile Issues in "operations.hpp"

本文关键字:hpp 问题 operations 编译 OpenCV      更新时间:2023-10-16

我正在尝试在Windows x64和Netbeans上安装openCV 2.4.2。我遵循了以下指南:http://projectsfromhellandmore.blogspot.co.nz/2012/06/opencv-241-netbeans-windows-7-plus.html

当我试图编译指南中包含的示例代码时,我在文件"include/opencv2/core/operations.hpp"中的以下代码块中遇到了以下错误,我还没有找到任何修复方法,也没有自己想好如何修复:

template<typename _Tp, typename _Base> inline void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
              Ptr<_Tp>& value, bool readOnly, Ptr<_Tp> (Algorithm::*getter)(), void (Algorithm::*setter)(const Ptr<_Tp>&),
              const string& help)
{
//TODO: static assert: _Tp inherits from _Base
addParam_(algo, parameter, ParamType<_Base>::type, &value, readOnly,
          (Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}

错误:得到2个模板参数,但需要1个

第二个有错误的代码块是:

template<typename _Tp> inline void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
              Ptr<_Tp>& value, bool readOnly, Ptr<_Tp> (Algorithm::*getter)(), void (Algorithm::*setter)(const Ptr<_Tp>&),
              const string& help)
{
//TODO: static assert: _Tp inherits from Algorithm
addParam_(algo, parameter, ParamType<Algorithm>::type, &value, readOnly,
          (Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}

错误:重新定义。。。(第一块代码中的功能)

感谢

我在使用opencvv2.4.x的MinGW时遇到了同样的问题,后来发现operations.hpp文件没有任何问题。相反,我安装的MinGW编译器出现了故障。我从sourcefourge重新安装了编译器,它起作用了。检查你的netbeans编译器。

我也遇到了同样的问题。这个问题的解决方案就是注释掉整个模板内联函数。这个函数在一个函数下面声明了两次,这就是问题的原因。只需评论其中一个。