记录详情

Compile Error

foo.cc:20:83: error: ‘by’ has not been declared
   20 |         Person(string& n,int by,int bm,int bd,int ly,int lm,int ld):Name(n);Birth(by,bm,bd);Leave(ly,lm,ld){
      |                                                                                   ^~
foo.cc:20:86: error: ‘bm’ has not been declared
   20 |         Person(string& n,int by,int bm,int bd,int ly,int lm,int ld):Name(n);Birth(by,bm,bd);Leave(ly,lm,ld){
      |                                                                                      ^~
foo.cc:20:89: error: ‘bd’ has not been declared
   20 |         Person(string& n,int by,int bm,int bd,int ly,int lm,int ld):Name(n);Birth(by,bm,bd);Leave(ly,lm,ld){
      |                                                                                         ^~
foo.cc:20:77: error: ISO C++ forbids declaration of ‘Birth’ with no type [-fpermissive]
   20 |         Person(string& n,int by,int bm,int bd,int ly,int lm,int ld):Name(n);Birth(by,bm,bd);Leave(ly,lm,ld){
      |                                                                             ^~~~~
foo.cc:20:91: error: ‘int Person::Birth(int, int, int)’ conflicts with a previous declaration
   20 |         Person(string& n,int by,int bm,int bd,int ly,int lm,int ld):Name(n);Birth(by,bm,bd);Leave(ly,lm,ld){
      |                                                                                           ^
foo.cc:17:14: note: previous declaration ‘Date Person::Birth’
   17 |         Date Birth;
      |              ^~~~~
foo.cc:20:99: error: ‘ly’ has not been declared
   20 |         Person(string& n,int by,int bm,int bd,int ly,int lm,int ld):Name(n);Birth(by,bm,bd);Leave(ly,lm,ld){
      |                                                                                                   ^~
foo.cc:20:102: error: ‘lm’ has not been declared
   20 |         Person(string& n,int by,int bm,int bd,int ly,int lm,int ld):Name(n);Birth(by,bm,bd);Leave(ly,lm,ld){
      |                                                                                                      ^~
foo.cc:20:105: error: ‘ld’ has not been declared
   20 |         Person(string& n,int by,int bm,int bd,int ly,int lm,int ld):Name(n);Birth(by,bm,bd);Leave(ly,lm,ld){
      |                                                                                                         ^~
foo.cc:20:93: error: ISO C++ forbids declaration of ‘Leave’ with no type [-fpermissive]
   20 |         Person(string& n,int by,int bm,int bd,int ly,int lm,int ld):Name(n);Birth(by,bm,bd);Leave(ly,lm,ld){
      |                                                                                             ^~~~~
foo.cc:22:9: error: ‘int Person::Leave(int, int, int)’ conflicts with a previous declaration
   22 |         }
      |         ^
foo.cc:18:14: note: previous declaration ‘Date Person::Leave’
   18 |         Date Leave;
      |              ^~~~~
foo.cc:23:14: error: variable or field ‘Output’ declared void
   23 |         void Output{
      |              ^~~~~~
foo.cc:26:9: error: expected ‘;’ at end of member declaration
   26 |         }
      |         ^
      |          ;
foo.cc: In constructor ‘Person::Person(std::string&, int, int, int, int, int, int)’:
foo.cc:20:75: error: no matching function for call to ‘Date::Date()’
   20 |         Person(string& n,int by,int bm,int bd,int ly,int lm,int ld):Name(n);Birth(by,bm,bd);Leave(ly,lm,ld){
      |                                                                           ^
foo.cc:10:9: note: candidate: ‘Date::Date(int, int, int)’
   10 |         Date(int y,int m,int d):year(y),month(m),day(d){
      |         ^~~~
foo.cc:10:9: note:   candidate expects 3 arguments, 0 provided
foo.cc:4:7: note: candidate: ‘constexpr Date::Date(const Date&)’
    4 | class Date{
      |       ^~~~
foo.cc:4:7: note:   candidate expects 1 argument, 0 provided
foo.cc:4:7: note: candidate: ‘constexpr Date::Date(Date&&)’
foo.cc:4:7: note:   candidate expects 1 argument, 0 provided
foo.cc:20:75: error: no matching function for call to ‘Date::Date()’
   20 |         Person(string& n,int by,int bm,int bd,int ly,int lm,int ld):Name(n);Birth(by,bm,bd);Leave(ly,lm,ld){
      |                                                                           ^
foo.cc:10:9: note: candidate: ‘Date::Date(int, int, int)’
   10 |         Date(int y,int m,int d):year(y),month(m),day(d){
      |         ^~~~
foo.cc:10:9: note:   candidate expects 3 arguments, 0 provided
foo.cc:4:7: note: candidate: ‘constexpr Date::Date(const Date&)’
    4 | class Date{
      |       ^~~~
foo.cc:4:7: note:   candidate expects 1 argument, 0 provided
foo.cc:4:7: note: candidate: ‘constexpr Date::Date(Date&&)’
foo.cc:4:7: note:   candidate expects 1 argument, 0 provided
foo.cc:20:76: error: expected ‘{’ at end of input
   20 |         Person(string& n,int by,int bm,int bd,int ly,int lm,int ld):Name(n);Birth(by,bm,bd);Leave(ly,lm,ld){
      |                                                                            ^
foo.cc: In member function ‘int Person::Leave(int, int, int)’:
foo.cc:22:9: warning: no return statement in function returning non-void [-Wreturn-type]
   22 |         }
      |         ^
foo.cc: In member function ‘bool Person::isOlderThan(const Person&)’:
foo.cc:28:18: error: ‘int Date::year’ is private within this context
   28 |         if(Birth.year!=other.Birth.year){
      |                  ^~~~
foo.cc:6:13: note: declared private here
    6 |         int year;
      |             ^~~~
foo.cc:28:36: error: ‘int Date::year’ is private within this context
   28 |         if(Birth.year!=other.Birth.year){
      |                                    ^~~~
foo.cc:6:13: note: declared private here
    6 |         int year;
      |             ^~~~
foo.cc:29:26: error: ‘int Date::year’ is private within this context
   29 |             return Birth.year<other.Birth.year;
      |                          ^~~~
foo.cc:6:13: note: declared private here
    6 |         int year;
      |             ^~~~
foo.cc:29:43: error: ‘int Date::year’ is private within this context
   29 |             return Birth.year<other.Birth.year;
      |                                           ^~~~
foo.cc:6:13: note: declared private here
    6 |         int year;
      |             ^~~~
foo.cc:31:18: error: ‘int Date::month’ is private within this context
   31 |         if(Birth.month!=other.Birth.month){
      |                  ^~~~~
foo.cc:7:13: note: declared private here
    7 |         int month;
      |             ^~~~~
foo.cc:31:37: error: ‘int Date::month’ is private within this context
   31 |         if(Birth.month!=other.Birth.month){
      |                                     ^~~~~
foo.cc:7:13: note: declared private here
    7 |         int month;
      |             ^~~~~
foo.cc:32:26: error: ‘int Date::month’ is private within this context
   32 |             return Birth.month<other.Birth.month;
      |                          ^~~~~
foo.cc:7:13: note: declared private here
    7 |         int month;
      |             ^~~~~
foo.cc:32:44: error: ‘int Date::month’ is private within this context
   32 |             return Birth.month<other.Birth.month;
      |                                            ^~~~~
foo.cc:7:13: note: declared private here
    7 |         int month;
      |             ^~~~~
foo.cc:34:22: error: ‘int Date::day’ is private within this context
   34 |         return Birth.day<other.Birth.day;
      |                      ^~~
foo.cc:8:13: note: declared private here
    8 |         int day;
      |             ^~~
foo.cc:34:38: error: ‘int Date::day’ is private within this context
   34 |         return Birth.day<other.Birth.day;
      |                                      ^~~
foo.cc:8:13: note: declared private here
    8 |         int day;
      |             ^~~
foo.cc: In function ‘int main()’:
foo.cc:46:12: error: ‘class Person’ has no member named ‘printInfo’
   46 |         p1.printInfo();
      |            ^~~~~~~~~
foo.cc:47:12: error: ‘class Person’ has no member named ‘printInfo’
   47 |         p2.printInfo();
      |            ^~~~~~~~~
foo.cc: At global scope:
foo.cc:48:6: error: expected unqualified-id before ‘else’
   48 |     }else{
      |      ^~~~
foo.cc:52:9: error: expected unqualified-id before ‘return’
   52 |         return 0;
      |         ^~~~~~
foo.cc:53:1: error: expected declaration before ‘}’ token
   53 | }
      | ^

信息

递交者
类型
自测
语言
C++
递交时间
2025-04-12 17:10:33
评测时间
2025-04-12 17:10:33
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes