[ROOT] Re: Problems with rootcint and STL classes

From: Gora Mohanty (gora@solar2.ucr.edu)
Date: Mon Jun 17 2002 - 03:13:28 MEST


Hi,
  Attached is a trivial example that reproduces the problem, along with a
simplified Makefile. Type "make" to compile, assuming GNU make. When I
try to compile this, it chokes on the rootcint step, where it is
generating the dictionary source. It seems that the problem is with
unsigned types, as replacing "unsigned int" with "int" (or even with
"double") in the template for the std::vector makes the problem go away.

  I have tried both version 3.03.04 and 3.03.05, compiling with gcc 3.1 on
a Linux x86 box running SuSe Linux 7.1. ROOT was also compiled with the
same compiler.

Regards,
Gora



#include <vector>
#include <Rtypes.h>

class A {
private:
  std::vector<unsigned int> v;
public:
  A(int ii=0) : v(ii) {}
  virtual ~A() {}
  ClassDef(A, 1)
};


#include "classA.h"
ClassImp(A)


#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class A+;
#endif


CXX          = g++
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) $(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