This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Undefined reference for static member of a template class


Hello,

I have a template class like this :

template <class ObjType>
class Mingleton{
public:
   
    static ObjType *OtherInstance( void ) {
        if ( mInstance == 0 ) {
            mInstance = new ObjType ;
        }
        return mInstance ;
    }
   
    static ObjType *mInstance ;
};

typedef Mingleton<ClassA>     ClassB;

in .cpp file, I have :

ClassB::OtherInstance();

The compiler (gcc 2.95.2-149) reports a undefined refence error during 
linkage. Any ideas ?

-- 
Devrim Erdem
-------------------------------------
VIRES Simulationstechnologie GmbH
Oberaustrasse 34
83026 Rosenheim
Germany
phone    +49.8031.463640
fax      +49.8031.463645
email    devrim@vires.com
internet www.vires.com
-------------------------------------



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]