Hi Antonio, I had the same problem a few days ago : - Masa's solution is : Hello Colin, I am happy to answer your question. For using STL container classes, you need to precompile them. In this case, you need to create following header file. // mystl.h #include <map> #include <vector> #ifdef __MAKECINT__ #pragma link C++ class map<int, const char*>; #pragma link C++ class vector< const char* >; #endif And use makecint. $ makecint -mk makefile -dl mystl.dll -H mystl $ make -f makefile Then, created mystl.dll includes definition of map<int, const char*> and vector<const char*>. Load thiss DLL or shared library when run that program. Thank you Masaharu Goto - And Here is Rene's advice : Compile your class with aclic : instead of doing .L myclass.C, do .L myclass.C++. This will generate a shared library and load it in root. Note that you have to use the ClassDef and ClassImp macros for my_class, so it can be used interactively (see the root user guide for more info, there is a chapter about aclic). cheers, Colin cbernet@cea.fr > Dear rooters, > I am trying to use a stl map into a myclass.C that I load with .L > Although I am including map.h it seems that as soon as I use the > my_class::Loop() function, the map symbol is not recognized and I got the > following error: > > Error: Symbol map is not defined in current scope FILE:my_class.C LINE:51 > > What should I add to my .C? > Also another question, should I use map<float,float> or > map<Float_t, Float_t>? > Thanks a lot, > Antonio > > P.S. I'm using root 3.02/01 > > > //----------- myclass.C > #include <TROOT.h> > #include <TChain.h> > #include <TFile.h> > #include <map.h> > class my_class { > public: > void Loop(); > ... > private: > ... > } > void my_class::Loop(){ > .... > map<float, float> pippo; > ... > } > > _______________________________________________________________________________ > a n t o n i o s i d o t i > > e-mail sidoti@science.unitn.it > sidoti@fnal.gov > www http://higgs.tn.infn.it/~sidoti/ > _______________________________________________________________________________ > "Il meglio e` nemico del buono" > >
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:11 MET