VS2019 C++未知覆盖说明符
VS2019 C++ unknown override specifier
我在使用 VS2019 编译我的C++代码时遇到困难。
我有 Person.h 头文件:
#ifndef PERSON_H
#define PERSON_H
#include <string>
using namespace std;
namespace PersonClass {
struct Person {
public:
Name name;
int age;
};
struct Name {
public:
string firstName;
string lastName;
};
}
#endif
这是我的主要.cpp:
#include "pch.h"
#include <iostream>
#include "Person.h"
using namespace std;
int main()
{
return 0;
}
当我编译此文件时,出现以下错误:
- "name":未知覆盖说明符缺少类型说明符 - int 假设。
- 注意:C++不支持默认整数
有人可以教我如何解决这个问题吗?
当您尝试使用它时,尚未定义struct Name
。在定义struct Person
之前定义struct Name
。
相关文章:
- 激励'inline'说明符的真实世界示例?
- 缺少类型说明符,显式类型为"缺少错误"
- 使用ios:ate写入到流会覆盖现有文件
- 我可以重新分配/覆盖std::字符串吗
- 为什么mpfr_printf与十六进制浮点(%a转换说明符)的printf不同
- 叮叮当当在修复时插入多个"覆盖"说明符
- 谷歌模拟和覆盖关键字
- TMap::Emplace() 在应用现有密钥时会覆盖吗?
- 此测试()中发生了什么意外过程?为什么总是覆盖 ch[0 1 2..]?
- 编译器错误:destuctor 的更宽松的抛出说明符
- 使用子类覆盖基类中定义的函数
- 当覆盖存在时调用基本虚拟"binded to object"函数
- 使用说明符 extern 声明的C++中的标识符链接
- 同时具有"外部"和"内联"说明符的变量
- 与 tesseract::TessBaseApi() 相关的 Tesseract-OCR 出错(预期的类型说明符)
- VS2019 C++未知覆盖说明符
- 是否可以要求虚函数使用C++"覆盖"说明符?
- 在 Visual Studio 中编译 gcc 代码会导致错误 C3646:"__attribute__":未知的覆盖说明符
- 'to_string'未知的覆盖说明符
- 未知的覆盖说明符+缺少类型说明符