方法参数中的 OpenCV 垫"预期")""

OpenCV Mat 'expected ")"' in method parameter

本文关键字:预期 OpenCV 参数 方法      更新时间:2023-10-16

我当前正在开发一个Mac应用程序,该应用程序涉及将C 和目标C混合。我试图将一部分应用程序分开为CPP源文件编译。

牢记我是非常适合使用C 的新手,如果我犯了一个非常愚蠢的错误,请原谅我。

我已经设法将其削减到了我可能的最小示例中。由于某种原因,当我在方法声明中使用Mat数据类型时,我得到

expected ')'

我的标题文件

#ifndef MATCHTEMPLATES_H
#define MATCHTEMPLATES_H
#include "opencv2/opencv.hpp"
class Matcher {
   public:
      Matcher(cv::Mat& template);
};
#endif

我的源文件

#include "Matcher.hpp"
using namespace cv;
Matcher::Matcher(Mat& template) { }

编译命令

clang++ -isystem /usr/local/Cellar/opencv3/3.1.0_3/include/opencv -isystem /usr/local/Cellar/opencv3/3.1.0_3/include -o CMakeFiles/Tracker.dir/source/cpp/Matcher.cpp.o -c {project location}/source/cpp/Matcher.cpp

是的,愚蠢的错误。

显然"模板"是C 中的保留单词

感谢塞巴斯蒂安·霍夫曼(Sebastian Hoffman)指出了这一点...