1

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

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

任何帮助将不胜感激谢谢

4

2 回答 2

1

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

于 2013-01-30T22:01:57.813 回答
1

I faced the same problem. the solution to this problem is just comment out the entire template inline function. this function is declared twice just below one another thats why the issue. just comment out one of them.

于 2013-04-17T12:41:59.527 回答