Hi Claus; For a static object, you need to have an initialization. So as you did: Int_t CError::count = 0; you need to do std::map<std::string,Int_t> CError::messages; This should not be located in the header file. Cheers, Philippe. -----Original Message----- From: owner-roottalk@pcroot.cern.ch [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Claus Horn Sent: Thursday, August 07, 2003 3:07 AM To: roottalk@pcroot.cern.ch Subject: [ROOT] static map Dear ROOTers, I have the folowing class: #include <map> #include <string> #include <TObject.h> #include "TStyle.h" class CError : public TObject { public: CError() {}; ~CError() {}; inline void werf(string msg); private: static Int_t count; //static map<string,Int_t> messages; map<string,Int_t> messages; ClassDef(CError,0) }; Int_t CError::count = 0; inline void CError::werf(string msg) { messages["hallo"] = 1; // does only work in the non static case ! } It works fine like this. But I wont to have the static map. Changing it to static results in: CError_C.so: undefined symbol: _6CError.messages What works for the integer does not seem to work for map. Does anyone have a solution for that? Regards, Claus Horn
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:14 MET