Hi Walter, the STL is not a universal blessing. It's power is in providing efficient default collection classes and ordering algorithms. However, STL classes have no notion of the framework in which they work and most frameworks don't know what to do with STL collections. The current version of ROOTCINT does not handle STL containers. That is, it will not generate correct Streamer code for list<int>. You will have to modify the generated Streamer by hand to correctly loop over the list<int> object. Using ROOT's TArrayI will work without problems. In principle CINT can parse all STL headers. The problems you currently see are due to macro definitions that can not be resolved by CINT's built-in preprocessor. A solution you can try is to define these macros using -D on the rootcint command line: rootcint TestCint.cc -c -D__PTRDIFF_TYPE__ -I/usr/gnu/lib/g++-include Test.h To see the allowed options that also can be passed to ROOTCINT do: cint -? We will make this more clear in the ROOTCINT documentation. If you get this to work don't forget to fix Streamer() for the list<int> object. Concerning ClassImp. We will fix this so it will work with template classes defined within the ROOT framework. In principle we could make an STL version that works with ROOT that way (adding ClassDef and ClassImp and by providing a correct Streamer()). However, that (the ROOT STL version) will not be for the very near future. Cheers, Fons. Walter Karig wrote: > > We use classes from the Standard Template Library (STL) and want to use > them together with ROOT. > > 1st Problem: The `ClassImp' macro doesn't work with template classes. > > 2nd Problem: `rootcint' doesn't work with STL, e.g. `list.h' from GNU, > HP and SGI. > > Any plan to fix this in future? > > Walter Karig > > ------------ > > This is a header file to test rootcint with `list.h' from the STL: > > // Test.cc: > > #include <list.h> > #include "Rtypes.h" > > class Test { > private: > list<int> li; // int list > public: > Test(); > ~Test(); > ClassDef(Test,0) // test class > }; > // EOF > > I'm trying to generate Streamer(), ... with rootcint: > > $ rootcint TestCint.cc -c Test.h > Error: source file "list.h" cannot open FILE:Test.h LINE:4 > > The `#include <list.h>' is in LINE:3, but anyway, > there is no list.h in $ROOTSYS/cint/include. Now I'm trying: > > $ rootcint TestCint.cc -c -I/usr/gnu/lib/g++-include Test.h > Limitation: can not handle macro __PTRDIFF_TYPE__ longint Use +P or -p option > FILE:/usr/gnu/lib/g++-include/_G_config.h LINE:21 > > Where is the documentation for such options? `+P' produces: > Error: source file "-I/cern/root/v1.00/include" cannot open FILE: LINE:0 > Next try: > > $ rootcint TestCint.cc -p -c -I/usr/gnu/lib/g++-include Test.h > Internal Error: malloc failed for _IO_stdin_ > FILE:/usr/gnu/lib/g++-include/libio.h LINE:208 > > `libio.h' was included from /usr/gnu/lib/g++-include/streambuf.h. > So last hope: include streambuf.h from $ROOTSYS/cint/include: > > $ rootcint TestCint.cc -p -c -I$ROOTSYS/cint/include -I/usr/gnu/lib/g++-include > Test.h > Error: Unexpected EOF G__fgetstream():2 FILE:Test.h LINE:737 ... (10 times) > Error: Unexpected EOF G__fgetc() FILE:Test.h LINE:737 > > Rootcint produces similar errors with original HP STL and SGI Implementation. > > +-----------------------------------------------------------------------------+ > | Walter Karig | Gesellschaft fuer Schwerionenforschung | > | Phone: 0049-6159-71-2147 | Planckstrasse 1 | > | E-Mail: W.Karig@gsi.de | D-64291 Darmstadt | > +-----------------------------------------------------------------------------+ -- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland Phone: +41 22 7679248 E-Mail: Fons.Rademakers@cern.ch Fax: +41 22 7677910
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:18 MET