> From: Denis Faivre [mailto:[EMAIL PROTECTED]] > When I declare a static data member (i.e. a class variable), > I get a link error... > > Link Error : main.cpp: 'Test::shared' referenced from > 'Test::SetShared(int)' is undefined. You need to define the class static variable. Put this at global scope in your .cpp file: int Test::shared = 0; // initializer optional, defaults to 0 > The same code works fine with GCC. Without this definition? That probably should not work. -slj-
- CW C++ : static data members Denis Faivre
- Re: CW C++ : static data members Marshall Clow
- Scott Johnson (WA)
