So I'm trying to practice basic inheritance. I have one main .cpp file with several classes and I tried to create a header file with another class derived from the parent class on the main file. Everything on the main file compiled and ran fine.
When I made the header file and included it, I got the error "expected class name before '{' token." Why doesn't recognize Person as a class name?? All the other classes on the main .cpp recognized it. I'm very confused lol. None of the functions of the parent class Person are passed to the derived class Student. They work with the other classes though.
../Student.h:13:1: error: expected class-name before '{' token
13 | {
| ^
../classes_objects.cpp: In member function 'int Person::person(std::string, int)':
../classes_objects.cpp:12:34: warning: no return statement in function returning non-void [-Wreturn-type]
12 | person(string job, int age) {}
| ^
../classes_objects.cpp: In function 'int main()':
../classes_objects.cpp:87:9: error: 'class Student' has no member named 'job'
87 | John.job = "student";
| ^~~
../classes_objects.cpp:88:9: error: 'class Student' has no member named 'age'
88 | John.age = 12;
| ^~~
../classes_objects.cpp:90:9: error: 'class Student' has no member named 'display'
90 | John.display();
| ^~~~~~~
make: *** [subdir.mk:20: classes_objects.o] Error 1
"make all" terminated with exit code 2. Build might be incomplete.