Hi all, I'm trying to implement a shared memory manager, and I want to use a singleton class to do so. I've also create a class to destroy the single instance on process shut down and do the detach and free the shared memory if the process is the last to detach. I found a good patter to do this using a friend destoyer class as a static data member ala http://lib.stat.cmu.edu/~lamj/sigs/c++-report/cppr9606.c.vlissides.html. I've cut my code right down to a skeloton that reprodices the error (attached) I'm getting wierd linker errors saying that the static destroyer class is undefined.... and nm confirms that the reference in Singleton.o is undefined.... but clearly the static reference Singleton::destroyer is defined in the header. I've had a couple of people to a quick sanity test to see if I've stuffed something obvious and we can't see anything. If anyone out there in gcc-land can provide some insight I'd be might grateful. BTW: I'm using gcc 2.96 Here's the output form make: [xbd@tfsec help]$ make ----------------------------------------------------------------------------- Generating: "Singleton.d" Reason: "Singleton.cpp Makefile" ----------------------------------------------------------------------------- /usr/bin/gcc -MMD -E -I/scratch/xbd/tflcs/src/include Singleton.cpp > /dev/null ----------------------------------------------------------------------------- Building: "Singleton.o", Reason: "Singleton.cpp Singleton.d Makefile Singleton.h" ----------------------------------------------------------------------------- /usr/bin/gcc -ggdb -pedantic -Wall -ansi -c -I/scratch/xbd/tflcs/src/include Singleton.cpp -o Singleton.o make -C test make[1]: Entering directory `/scratch/xbd/tflcs/src/util/help/test' ----------------------------------------------------------------------------- Generating: "SingletonTest.d" Reason: "SingletonTest.cpp Makefile" ----------------------------------------------------------------------------- /usr/bin/gcc -MMD -E -I/scratch/xbd/tflcs/src/include -I.. -I../../include SingletonTest.cpp > /dev/null make[1]: Leaving directory `/scratch/xbd/tflcs/src/util/help/test' make[1]: Entering directory `/scratch/xbd/tflcs/src/util/help/test' ----------------------------------------------------------------------------- Building: "SingletonTest.o", Reason: "SingletonTest.cpp SingletonTest.d Makefile ../Singleton.h" ----------------------------------------------------------------------------- /usr/bin/gcc -ggdb -pedantic -Wall -ansi -c -I/scratch/xbd/tflcs/src/include -I.. -I../../include SingletonTest.cpp -o SingletonTest.o SingletonTest.cpp: In function `int main (int, char **)': SingletonTest.cpp:8: warning: unused variable `Singleton *tmp' ----------------------------------------------------------------------------- Linking: "SingletonTest", Reason: "SingletonTest.o Makefile" ----------------------------------------------------------------------------- /usr/bin/gcc -ggdb -pedantic -Wall -ansi -lstdc++ ../Singleton.o SingletonTest.o -o SingletonTest ../Singleton.o: In function `Singleton::getInstance(void)': /scratch/xbd/tflcs/src/util/help/Singleton.cpp:34: undefined reference to `Singleton::destroyer' collect2: ld returned 1 exit status make[1]: *** [SingletonTest] Error 1 make[1]: Leaving directory `/scratch/xbd/tflcs/src/util/help/test' make: *** [test] Error 2 <> <> <>