继承时找不到类名
Class name not found when inheriting
我在从类继承时遇到问题,在互联网上查找错误被认为是循环包含,但我没有看到我在代码中是如何做到这一点的。
错误如下:
./src/Camera.hpp:6:40: error: expected class-name before ‘{’ token
class Camera : public cv::VideoCapture {
我从中继承的类是OpenCV的一部分。以下是代码的相关部分:
main.cpp:
#include <opencv2/core.hpp>
#include "Camera.hpp"
int main(int argc, char** argv){
Camera camera = Camera(/*Some parameters*/);
return 0;
}
Camera.hpp
#ifndef CAMERA_H
#define CAMERA_H
#include <opencv2/core.hpp>
class Camera : public cv::VideoCapture {
public:
Camera(/*Some parameters*/);
};
#endif
main.cpp中还包含一些其他文件,但我确保(为了测试)它们都没有使用Camera.hpp。我做错了什么?
感谢
如果它不知道VideoCapture
是一个类,那么可能您没有包含正确的头文件。
http://docs.opencv.org/java/2.4.8/org/opencv/highgui/VideoCapture.html提示CCD_ 2。
相关文章:
- std::map<struct,struct>::find 找不到匹配项,但是如果我循环通过 begin() 到 end(),我在那里看到匹配项
- 找不到成员对象:没有名为get_event()的成员,也处理多态性和向量
- 为什么野牛仍在使用"int yylex(void)",却找不到"int yylex(YYS
- C++ Windows 驱动程序MSB3030无法复制该文件,因为它找不到
- 奇怪的(对我来说)返回声明 - 在谷歌上找不到任何关于它的信息
- 找不到QtResource文件中的文件
- VC++本机单元测试,找不到调试符号
- RegGetValue在当前用户下找不到名称
- 带有 -stdlib=libc++ 的 clang++ 9.0.1 找不到<optional>
- c++找不到具有相同哈希的无序集合元素
- 找不到以下加速库:boost_fiber
- 找不到 FLTK(缺少:FLTK_INCLUDE_DIR)
- 设置 Visual Studio for MPI: 找不到标识符错误
- "assimp/config.h"找不到,但它在文件夹中
- 链接器找不到在虚拟类 c++ 中访问的静态字段的符号
- C++系统找不到指定的文件错误
- 派生类继承的 getter,找不到返回正确值的方法
- 继承(通过文件)找不到类
- C++找不到从当前模板类继承的模板基类中定义的类型
- 继承时找不到类名