Lewie
Lewie

Reputation: 21

OpenCV 2.4.2 Compile Issues in "operations.hpp"

I am trying to install openCV 2.4.2 on Windows x64 and Netbeans. I have followed the following guide: http://projectsfromhellandmore.blogspot.co.nz/2012/06/opencv-241-netbeans-windows-7-plus.html

When I try to compile the sample code included in the guide I get the following errors for the following blocks of code in the file "include/opencv2/core/operations.hpp" and I have not found any fixes or figured out how to fix it myself:

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);
}

error: got 2 template parameters but 1 required

And the second block of code with an error is:

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);
}

error: redefinition of ...(the function in the first block of code)

Any help would be greatly appreciated thanks

Upvotes: 1

Views: 1672

Answers (2)

selvakumar jawahar
selvakumar jawahar

Reputation: 11

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.

Upvotes: 1

Priyanka Baheti
Priyanka Baheti

Reputation: 11

I faced the same problem with MinGW with opencv2.4.x and later on found out that there was nothing wrong with the operations.hpp file. Instead, the MinGW compiler that i had installed was at fault. I reinstalled the compiler from sourcefourge and it worked. Check your netbeans compiler.

Upvotes: 1

Related Questions