I have 3 files: ***.cpp *2 and ***.h *1
once i put into terminal: g++ mymain.cpp landowner.cpp -o mymain it says
error: ‘landowner’ was not declared in this scope 8 | landowner Alex; | ^~~~~~~~~
//landowner.h
#ifndef LANDOWNER
#define LANDOWNER
using namespace std;
void ShowScore();
#endif
//landowner.cpp
#include "landowner.h"
#include <iostream>
class landowner
{
private:
string name;
long score;
int cards[20];
public:
landowner(){}
~landowner(){}
void ShowScore(){
cout<<name<<"current score:"<<score<<endl;
}
protected:
};
//mymain.cpp
#include <iostream>
#include "landowner.h"
using namespace std;
int main(){
landowner Alex;
Alex.name = Alex;
Alex.score = 100;
Alex.ShowScore();
return 0;
}
which is very confusing. i must have missed something. Can someone help me? Thanks!