Jean-Pierre
Jean-Pierre

Reputation: 1

OpenCV - Error C2244

I'm currently on vacation far away from my desktop, however I wanted to practice my c++ in particular with openCV, so I brought my laptop along. Given time and family constraints I didn't get everything set up in time with the libraries before flying.

I've set everything up with regards to VS 2010 as I recall doing on my desktop a while ago, but on compiling the test example on the openCV website (http://opencv.willowgarage.com/wiki/VisualC%2B%2B) I receive the following errors:

Error   3   error C2244: 'cv::Matx<_Tp,,>::diag' : unable to match function definition to an existing declaration   C:\Program Files\OpenCV2.2\include\opencv2\core\operations.hpp  372
Error   4   error C2244: 'cv::Matx<_Tp,,>::diag' : unable to match function definition to an existing declaration   C:\Program Files\OpenCV2.2\include\opencv2\core\operations.hpp  448

which in turn shows me:

template<typename _Tp, int m, int n> inline Matx<_Tp,m,n> Matx<_Tp,m,n>::diag(const Matx<_Tp,MIN(m,n),1>& d) { Matx<_Tp,m,n> M; for(int i = 0; i < MIN(m,n); i++) M(i,i) = d[i]; return M; }

template<typename _Tp, int m, int n> inline Matx<_Tp, MIN(m,n), 1> Matx<_Tp, m, n>::diag() const { diag_type d; for( int i = 0; i < MIN(m, n); i++ ) d.val[i] = val[i*n + i]; return d; }

I've looked into this error on the msdn and have looked on the openCV forums, but I couldn't find record of this specific error and I'm not sure how to resolve it.

Is it also problematic that I'm running the 64 bit version of Windows 7? I read that openCV2.2 is compatible however previously while the programs would compile, it kept on saying the .dll files were missing even though the PATH variable and directories were correct.

Thanks, Jean-Pierre

Upvotes: 0

Views: 1218

Answers (2)

Linus Atorf
Linus Atorf

Reputation: 11

It seems indeed that the option advanced compiler option "/analyze" causes this problem (I'm using OpenCV 2.2 with VS 2008 on Win XP 32bit). I could fix the first error:

In line 365, you got to replace Matx<_Tp,MIN(m,n),1> with diag_type, i.e. this

template<typename _Tp, int m, int n> inline
Matx<_Tp,m,n> Matx<_Tp,m,n>::diag(const Matx<_Tp,MIN(m,n),1>& d)

becomes

template<typename _Tp, int m, int n> inline
Matx<_Tp,m,n> Matx<_Tp,m,n>::diag(const diag_type& d)

Unfortunately, the 2nd error still occurs -- I found no way to get rid of it but to deactivate \analyze :-(

1>D:\OpenCV2.2\include\opencv2/core/operations.hpp(447) : error C2244: 'cv::Matx<_Tp,,>::diag':  
unable to match function definition to an existing declaration

If you find a way to fix this, please let me know -- I think I'll go ahead and post a bug-report-ticket on OpenCV Trac now...

Upvotes: 1

user737903
user737903

Reputation: 11

I had the same issue running Opencv2.2 on 32bit Win7 VS2010 and QT 4.7.2.

I doesn't seem to be an error that affects the actual function of code. When I turned code analysis off as Himanshu jain described above it fixed the problem.

Upvotes: 1

Related Questions