Hi,
I do not know if my previous message went missing somehow, but I am
getting frustrated with this problem. Attached are files that will
reproduce the error: compile with "make" assuming GNU make. I have tried
various versions of root including 3.03.05 and 3.03.06, with gcc 3.0
and 3.1 on a Linux SuSE 7.1 box. Even if this is not possible in the
interpreter currently, it would be nice to know that.
With gcc 3.0 (ROOT is also compiled with 3.0), I get the following
errors at the rootcint step:
Error: class,struct,union or type __traits_type::iterator_category not defined FILE:/usr/local/root/new/cint/lib/prec_stl/iterator LINE:260
Error: class,struct,union or type __traits_type::value_type not defined FILE:/usr/local/root/new/cint/lib/prec_stl/iterator LINE:261
Error: class,struct,union or type __traits_type::difference_type not defined FILE:/usr/local/root/new/cint/lib/prec_stl/iterator LINE:262
Error: class,struct,union or type __traits_type::pointer not defined FILE:/usr/local/root/new/cint/lib/prec_stl/iterator LINE:263
Error: class,struct,union or type __traits_type::reference not defined FILE:/usr/local/root/new/cint/lib/prec_stl/iterator LINE:264
These errors go away, and everything compiles fine if I replace "unsigned int"
with "int" in the class template.
With gcc 3.1 (and ROOT, likewise, compiled with 3.1), the dictionary source
seems to be generated without problems after I #define random_access_iterator
to iterator, but g++ then chokes on the generated source, with reams of errors
along the lines of:
classADict.cxx: In function `int
G__vectorlEintcO__malloc_alloc_templatelE0gRsPgR_begin_0_0(G__value*, const
char*, G__param*, int)':
classADict.cxx:319: `class __gnu_cxx::__normal_iterator<int*, std::vector<int,
std::__malloc_alloc_template<0> > >' used where a `long int' was expected
Thanks for any help.
Regards,
Gora
#include <vector>
#include <Rtypes.h>
#if GCC_MAJOR == 3 && GCC_MINOR == 1
// gcc 3.1 has only iterator, not random_access_iterator
#ifndef __CINT__
#define random_access_iterator iterator
#endif // #ifndef __CINT__
#endif // #if GCC_MAJOR...
template<typename T>
class A {
private:
std::vector<T> v;
public:
A(int ii=0) : v(ii) {}
virtual ~A() {}
ClassDefT(A, 1)
};
ClassDefT2(A, T);
#include "classA.h"
ClassImpT(A, T)
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class vector<unsigned int>+;
#pragma link C++ class A<unsigned int>+;
#endif
CXX = g++
GCC_VER := $(shell $(CXX) -v 2>&1 | awk 'END{print $$NF}')
GCC_MAJOR := $(shell echo $(GCC_VER) 2>&1 | sed 's/\(^.*\)\..*/\1/')
GCC_MINOR := $(shell echo $(GCC_VER) 2>&1 | sed 's/.*\.\(.*\)/\1/')
DEFS := -DGCC_MAJOR=$(GCC_MAJOR) -DGCC_MINOR=$(GCC_MINOR)
CXXOPTS = -O2
CXXFLAGS = -ansi -pedantic -Wall -W -Wwrite-strings -Wmissing-prototypes -Woverloaded-virtual -Wsign-promo -Wno-long-long -Wno-unused
CXXINCS =
SOFLAGS = -shared
CXXLIBS = -lm -ldl -rdynamic
SYSXLIBS = -L/usr/X11R6/lib -lXpm -lX11
CINTSYSDIR = $(ROOTSYS)/cint
ROOTLIBS := $(shell root-config --libs)
ROOTGLIBS := $(shell root-config --glibs)
ROOTINCS = -I$(ROOTSYS)/include
ROOTCINT = $(ROOTSYS)/bin/rootcint
CINTINCS = $(CXXINCS) $(ROOTINCS)
INCLUDES = $(CXXINCS) $(ROOTINCS)
LIBS = $(CXXLIBS) $(ROOTLIBS)
GLIBS = $(ROOTGLIBS) $(SYSXLIBS)
all:
@echo -e \\nGenerating object file
$(CXX) $(CXXOPTS) $(CXXFLAGS) $(INCLUDES) -c -o classA.o classA.cxx
@echo -e \\nGenerating dictionary source
$(ROOTCINT) -f classADict.cxx -c -p $(CINTINCS) classA.h classALinkDef.h
@echo -e \\nGenerating dictionary object file
$(CXX) $(CXXOPTS) $(DEFS) $(CXXFLAGS) $(INCLUDES) -I$(CINTSYSDIR) -c -o classADict.o classADict.cxx
@echo -e \\nMaking shared library
$(CXX) $(SOFLAGS) $(CXXOPTS) $(CXXFLAGS) classA.o classADict.o -o libclassA.so
clean:
rm -f classA.o classADict.o classADict.cxx classADict.h core
distclean: clean
rm -f libclassA.so
realclean: distclean
rm -f *~
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:57 MET