0

Linker error: tried to make basic cpp program but there is a linker error saying:unresolved symbol "private: static int complex::count". When i removed the static words, its working fine.

Please find Program sample on this link

Barmar
  • 741,623
  • 53
  • 500
  • 612

1 Answers1

0

you must explicitly define your static variable outside of the class. For example like this:

class complex {
   ....
   int static count;
   ....
};
// initialization
int complex::count = 0;
iskakoff
  • 98
  • 1
  • 4