[英]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
這是我的 main.cpp:
#include "pch.h"
#include <iostream>
#include "Person.h"
using namespace std;
int main()
{
return 0;
}
當我編譯這個文件時,我收到以下錯誤:
有人可以教我如何解決這個問題嗎?
當您嘗試使用它時,尚未定義struct Name
。 在定義struct Person
之前定義struct Name
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.