Hello all,

I'm working in Borland C++ Builder v6.0 (maintenance/rewriting some code). I have a class where I'd like to have a static function call a member function on all instantiated members of the class. (Motive: update all at once, where the update function only exists as a member of the base class.)

The way I thought to do this was to have a vector of pointers to the class inside the class itself. Upon construction, each object would add its "this" pointer to the vector. Then on calling the static function, iterate through all pointers in the vector, calling the update function.

It seems the linker doesn't like something about the vector, I get:
"[Linker Error] Unresolved external 'MyClass::vec' referenced from PATH\FILENAME.OBJ"

I was just trying a dummy class to prove it was doable. Am I doing something wrong? Or is this not possible? (If not, why not?)

Code is below. Thanks.

#include <vcl.h>
#include <vector>
#pragma hdrstop

using std::vector;


class MyClass {
        static vector<MyClass*> vec;
        int m;

MyClass::MyClass() {


#pragma argsused
int main(int argc, char* argv[])
    MyClass mc;

    return 0;