How to fix Id returned 1 exit status?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <iostream>
using namespace std;

class X{
      static int x;
      
      public:
             void setx(int n){x = n;};
             int getx(){return x;};
             
             
};


int main(){
    
    X a,b;
    
    a.setx(6);
    b.getx();
    
    cout << b.getx() <<endl;

    return 0;
    
}


Currently i am testing how to use the static type variable. But now i am stucked by this error message. I have read some other forum, they said is the linker problem, but i don't really understand them...
Oh just realize i need to ''redeclare'' the static variable with known a value.
Topic archived. No new replies allowed.