OpenCV 2.4.2编译" operations.hpp"

时间:2012-08-02 12:59:32

标签: c++ opencv

我正在尝试在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);
}

错误:重新定义...(第一个代码块中的函数)

非常感谢任何帮助,谢谢

2 个答案:

答案 0 :(得分:1)

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

答案 1 :(得分:1)

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

相关问题