返回c++中无法识别的类类型
Return class type not recognized in c++
我写了一个类:
CVerifObj.hpp :
#pragma once
#include <vector>
class VerifObj
{
private:
cv::Mat m_image;
PointVector m_plateContour;
std::string m_imageName;
public:
VerifObj(const fs::path& imgNameIn);
~VerifObj();
cv::Mat getImage() const;
std::string getImageName() const;
PointVector getPlateContour() const;
};
typedef std::vector< VerifObj > VerifObjVector;
具有实现,并且用作另一个类中包含其头文件的另一个函数的类型:
MyCls.hpp :
#pragma once
#include "CVerifObj.hpp"
class MyCls
{
public:
MyCls();
~MyCls();
static VerifObjVector foo(); // error is here
};
我得到的问题是它不被识别:
/home/sop/proj/CMyCls.hpp:52:2: error: ‘VerifObjVector’ does not name a type
我已经在CMake文件中添加了它。为什么会发生这种情况?
您还没有包含std::vector
定义:
#include <vector>
您可能直接或间接地将MyCls.hpp
包含在CVerifObj.hpp
中,这导致循环包含。这可能会导致问题(未定义的类型)。
相关文章:
- std::visit无法识别类型
- 我有两个类需要在同一 cpp 文件中相互引用,但第一个类无法识别第二个类类型的对象
- 我的头文件 DNode 中的我的数据类型未被识别为数据类型
- 无法在VSCode中设置C++调试;无法识别调试类型
- C++ 编译错误:gnu_printf是无法识别的格式函数类型
- C++将 wwn 字符串转换为识别为十六进制的数据类型
- 编写完整专业化以识别void类型的问题
- 无法识别协变返回类型
- 我该如何允许类型的对象非专业化并在不使用指针的情况下识别何时是这种情况
- 为什么模板<类型名...>不能通过模板<模板类型名>识别为可实例化<typename>?
- CGAL 无法识别类型
- 为什么我的Visual Studio 2017编译器无法识别C++17类型推导指南
- 当例外处理时,类型识别如何工作
- 无法识别初始化类型
- 从基类识别派生的类类型
- ActiveMQCPP - 识别测量类型
- 运算符 + 无法识别类型
- 无法识别'regex'类型
- 嵌套成员类型识别
- C++运行时数据类型识别并避免切换大小写