在C ++中包含它的标题时出现OpenCV错误

时间:2015-05-07 18:00:07

标签: c++ templates opencv compiler-errors opencv3.0

我正在尝试将OpenCV用于现有项目;当我将标题#include <opencv2/opencv.hpp>添加到我的source.cc文件(只是标题,其余代码没有区别)时,我收到以下错误。

make all 
Building file: source.cc
Invoking: GCC C++ Compiler
g++ -I../__GXX_EXPERIMENTAL_CXX0X__ -I/usr/include/eigen3 -O3 -Wall -c -fmessage-length=0 -std=c++11 -MMD -MP -MF"source.d" -MT"source.d" -o "source.o" "source.cc"
In file included from /usr/local/include/opencv2/core.hpp:3105:0,
                 from /usr/local/include/opencv2/opencv.hpp:46,
                 from source.cc:13:
/usr/local/include/opencv2/core/operations.hpp: In member function ‘bool cv::internal::Matx_FastSolveOp<_Tp, m, n>::operator()(const cv::Matx<_Tp, m, m>&, const cv::Matx<_Tp, m, n>&, cv::Matx<_Tp, m, n>&, int) const’:
/usr/local/include/opencv2/core/operations.hpp:131:18: error: missing template arguments before ‘(’ token
         return LU(temp.val, m*sizeof(_Tp), m, x.val, n*sizeof(_Tp), n) != 0;
                  ^
make: *** [MapMaker_target_init.o] Error 1

代码看起来像这样:

MMaker.cc&gt;&gt;&gt;

#include "MMaker.h"
#include "IMatcher.h"
#include <cvd/image_ref.h>
#include <cvd/vector_image_ref.h>
#include <cvd/vision.h>
#include <cvd/image_interpolate.h>
#include <opencv2/opencv.hpp>  // <<<<<<<<<< This is the evil line

bool MMaker::init(AR::IMatcher &matcher)
{
    //actually empty
}

MMaker.h&gt;&gt;&gt;

#ifndef __MMAKER_H
#define __MMAKER_H

#include <queue>

namespace AR { class IMatcher; }
class MMaker: protected CVD::Thread
{
public:
    bool init(AR::IMatcher &matcher);
    // ... more stuff ...
}
//...

IMatcher.h&gt;&gt;&gt;

#ifndef __IMATCHER_H
#define __IMATCHER_H

#include <vector>
#include <string>

namespace cv { class Mat; }
namespace AR
{ 
  class IMatcher
  {
    // ... IMatcher members declaration ...
  }
}

IMatcher.cc&gt;&gt;&gt;

#include "IMatcher.h"

#include <opencv2/opencv.hpp>
#include <opencv2/xfeatures2d.hpp>

// ... IMatcher members implementation ... 

我知道这可能与包含哪些文件或包含哪些文件有关,但是没有找到遗漏的内容。

0 个答案:

没有答案
相关问题