OpenCV - 错误C2244

时间:2011-01-21 21:03:34

标签: c++ visual-studio-2010 opencv

我目前正在远离我的桌面度假,但是我想特别使用openCV来练习我的c ++,所以我带着我的笔记本电脑。考虑到时间和家庭的限制,我没有在飞行前及时与图书馆建立一切。

我已经设置了关于VS 2010的所有内容,我记得刚刚在我的桌面上进行操作,但是在openCV网站上编译测试示例(http://opencv.willowgarage.com/wiki/VisualC% 2B%2B)我收到以下错误:

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

反过来告诉我:

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

我在msdn上查看了这个错误并查看了openCV论坛,但我找不到这个特定错误的记录,我不知道如何解决它。

我运行的是64位版本的Windows 7,这也有问题吗?我读到openCV2.2是兼容的,但是之前程序会编译,它继续说.dll文件丢失,即使PATH变量和目录是正确的。

谢谢, 让 - 皮埃尔

2 个答案:

答案 0 :(得分:1)

我遇到了在32位Win7 VS2010和QT 4.7.2上运行Opencv2.2的相同问题。

我似乎不是一个影响代码实际功能的错误。当我按照上面描述的Himanshu jain关闭代码分析时,它修复了问题。

答案 1 :(得分:1)

确实选项高级编译器选项“/ analyze”导致了这个问题(我在Win XP 32bit上使用OpenCV 2.2和VS 2008)。我可以解决第一个错误:

在第365行中,您必须将Matx<_Tp,MIN(m,n),1>替换为diag_type,即此

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)

变为

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

不幸的是,第二个错误仍然存​​在 - 我发现没有办法摆脱它而是停用\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

如果您找到解决此问题的方法,请告知我们 - 我想我会继续在OpenCV Trac上发布错误报告单...

相关问题