VS2019 C++;未知重写说明符 我很难用VS2019编译我的C++代码。

VS2019 C++;未知重写说明符 我很难用VS2019编译我的C++代码。,c++,syntax,compiler-errors,include,visual-studio-2019,C++,Syntax,Compiler Errors,Include,Visual Studio 2019,我有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 firstNam

我有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
\ifndef PERSON\u H
#定义人
#包括
使用名称空间std;
命名空间PersonClass{
结构人{
公众:
姓名;
智力年龄;
};
结构名{
公众:
字符串名;
字符串lastName;
};
}
#恩迪夫
以下是我的主要内容。cpp:

#include "pch.h"
#include <iostream>
#include "Person.h"
using namespace std;
int main()
{
return 0;
}
#包括“pch.h”
#包括
#包括“Person.h”
使用名称空间std;
int main()
{
返回0;
}
编译此文件时,出现以下错误:

  • “名称”:未知重写说明符缺少类型说明符-int 假定的 注解:C++不支持默认INT/LI>
    有人能教我如何解决这个问题吗

    struct Name
    在您尝试使用它时尚未定义。在定义
    struct Person
    之前定义
    struct Name

    struct Name
    在您尝试使用它时尚未定义。定义
    struct Name
    之前,请先定义
    struct Person

    您的编译器不是算命师。在
    名称中使用它之前,它应该知道
    名称是什么。订购事宜!事物在使用之前需要声明。你应该先定义
    ,然后定义
    名称
    你的编译器不是算命师。在
    名称中使用它之前,它应该知道
    名称是什么。订购事宜!事物在使用前需要声明。您应该首先定义
    ,然后定义
    名称