Hi all,
I have these two classes with following structure
When compiling the above code, there were no errors. However, upon linking I get the following error
error LNK2001: unresolved external symbol "public: static bool Tree::flag" (?flag@Tree@@2_ NA)
fatal error LNK1120: 1 unresolved externals
What am I doing wrong here?
I have these two classes with following structure
Code:
//main.cpp
class Tree {
public:
static bool flag;
Tree() {
flag = true;
}
};
class b {
public:
static bool isValid();
};
static isValid() {
if (Tree::flag) ... some code
}
error LNK2001: unresolved external symbol "public: static bool Tree::flag" (?flag@Tree@@2_ NA)
fatal error LNK1120: 1 unresolved externals
What am I doing wrong here?
Comment