The #ifdef/#ifndef mods Fons sent me work just fine. Thanks a million. I have no problem with rootcint now. Now I have some sort of function prototyping problem because one class demands functionality defined in another class: rootcint paramVecDict.cc -c paramVec.h Note: operator new() masked c Note: operator delete() masked c class paramVec in paramVec.h line 46 original base of virtual func g++ -O -fPIC -I/oscar/public/root/include -c paramVecDict.cc -o paramVecDict.o paramVecDict.cc: In method `void paramVec::Streamer(class TBuffer &)': paramVecDict.cc:537: no match for `operator <<(class TBuffer, class param *)' make: *** [paramVecDict.o] Error 1 brannon@surf ~/rs/VisionMagick/terry : ==== The reason this occurs is that the class paramVec has an object of class param as a component. When the Streamer for class paramVec attempts to write its "s" field which is of class param, it is implicitly looking for an output operator of type param: void paramVec::Streamer(TBuffer &R__b) { // Stream an object of class paramVec. if (R__b.IsReading()) { Version_t R__v = R__b.ReadVersion(); R__b >> len; R__b >> s; // ******* <----- s is of type param *************** } else { R__b.WriteVersion(paramVec::IsA()); R__b << len; R__b << s; } } I have generated such an operator by successfully running rootcint on the class param, generating paramDict.{cc,h}. However, there is nothing in paramDict.h which "prototypes" the output operator, hence I cant just include paramDict.h in paramVecDict.h. But I must have some way of letting g++ know that there is indeed an output operator for things of class param, it's just defined in a .cc file with no header. 1:How is this done? 2:Once I create the .o files and dictionaries for param.cc and paramVec.cc, what do I need to do to get HTML out of them? It's probably not necessary, but I include all the pertinent files: ============================== param.defs.h // This may look like C code, but it is really -*- C++ -*- /* Copyright (C) 1988 Free Software Foundation written by Doug Lea (dl@rocky.oswego.edu) This file is part of the GNU C++ Library. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _paramdefs_h #define _paramdefs_h 1 #ifdef __CINT__ class String; // this is enough don't need to load all iostream.h #else #include <String.h> #endif #ifdef __CINT__ typedef void (*one_arg_error_handler_t)(const char*); typedef void (*two_arg_error_handler_t)(const char*, const char*); #endif #include "Rtypes.h" // required for ClassDef class param { public: ClassDef(param,1) String name; String val_strings[2]; /* current and default val strings */ int operator==(const param &p2) const { return (name == p2.name); } }; // equality operator #ifndef paramEQ #define paramEQ(a, b) ((a) == (b)) #endif // less-than-or-equal #ifndef paramLE #define paramLE(a, b) ((a) <= (b)) #endif // comparison : less-than -> < 0; equal -> 0; greater-than -> > 0 #ifndef paramCMP #define paramCMP(a, b) ( ((a) <= (b))? (((a) == (b))? 0 : -1) : 1 ) #endif // hash function #ifndef paramHASH extern unsigned int hash(param&); #define paramHASH(x) hash(x) #endif // initial capacity for structures requiring one #ifndef DEFAULT_INITIAL_CAPACITY #define DEFAULT_INITIAL_CAPACITY 100 #endif // HASHTABLE_TOO_CROWDED(COUNT, SIZE) is true iff a hash table with COUNT // elements and SIZE slots is too full, and should be resized. // This is so if available space is less than 1/8. #define HASHTABLE_TOO_CROWDED(COUNT, SIZE) ((SIZE) - ((SIZE) >> 3) <= (COUNT)) #endif ====================================== paramVec.h // This may look like C code, but it is really -*- C++ -*- /* Copyright (C) 1988 Free Software Foundation written by Doug Lea (dl@rocky.oswego.edu) This file is part of the GNU C++ Library. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _paramVec_h #ifdef __GNUG__ #pragma interface #endif #define _paramVec_h 1 #ifndef __CINT__ #include <builtin.h> #else typedef void (*one_arg_error_handler_t)(const char*); typedef void (*two_arg_error_handler_t)(const char*, const char*); #endif #include "param.defs.h" #include "Rtypes.h" // required for ClassDef #ifndef _param_typedefs #define _param_typedefs 1 typedef void (*paramProcedure)(param&); typedef param (*paramMapper)(param&); typedef param (*paramCombiner)(param&, param&); typedef int (*paramPredicate)(param&); typedef int (*paramComparator)(param&, param&); #endif class paramVec { protected: int len; // put comments here (will go in doc) param *s; // idem... paramVec(int l, param* d); public: ClassDef(paramVec,1) paramVec (); paramVec (int l); paramVec (int l, param& fill_value); paramVec (const paramVec&); ~paramVec (); paramVec & operator = (const paramVec & a); paramVec at(int from = 0, int n = -1); int capacity() const; void resize(int newlen); param& operator [] (int n); param& elem(int n); friend paramVec concat(paramVec & a, paramVec & b); friend paramVec map(paramMapper f, paramVec & a); friend paramVec merge(paramVec & a, paramVec & b, paramComparator f); friend paramVec combine(paramCombiner f, paramVec & a, paramVec & b); friend paramVec reverse(paramVec & a); void reverse(); void sort(paramComparator f); void fill(param& val, int from = 0, int n = -1); void apply(paramProcedure f); param reduce(paramCombiner f, param& base); int index(param& targ); friend int operator == (paramVec& a, paramVec& b); friend int operator != (paramVec& a, paramVec& b); void error(const char* msg); void range_error(); }; extern void default_paramVec_error_handler(const char*); extern one_arg_error_handler_t paramVec_error_handler; extern one_arg_error_handler_t set_paramVec_error_handler(one_arg_error_handler_t f); inline paramVec::paramVec() { len = 0; s = 0; } inline paramVec::paramVec(int l) { s = new param [len = l]; } inline paramVec::paramVec(int l, param* d) :len(l), s(d) {} inline paramVec::~paramVec() { delete [] s; } inline param& paramVec::operator [] (int n) { if ((unsigned)n >= (unsigned)len) range_error(); return s[n]; } inline param& paramVec::elem(int n) { return s[n]; } inline int paramVec::capacity() const { return len; } inline int operator != (paramVec& a, paramVec& b) { return !(a == b); } #endif ======================================= root_makefile #--------------------------------------------------- CXX = g++ CXXFLAGS = -O -fPIC -I$(ROOTSYS)/include LD = g++ LDFLAGS = -g SOFLAGS = -Wl,-soname,libEvent.so -shared LIBS = $(ROOTLIBS) -lg++ -lm -ldl -rdynamic GLIBS = $(ROOTLIBS) $(ROOTGLIBS) -L/usr/X11R6/lib -lXm -lXpm \ -lXt -lXext -lX11 -lg++ -lm -ldl -rdynamic HDRS = paramVec.h SRCS = small_main.cc paramVec.cc paramVecDict.cc paramDict.cc OBJS = small_main.o paramVec.o paramVecDict.o paramDict.o PROGRAM = myroot all: clean $(PROGRAM) $(PROGRAM): $(OBJS) echo "Linking $(PROGRAM) ..." $(LD) $(LDFLAGS) $(OBJS) $(LIBS) -o $(PROGRAM) echo "done" clean:; rm -f $(OBJS) core *Dict.* ### paramVec.o: paramVec.h paramVecDict.cc: paramVec.h echo "Generating dictionary ..." rootcint paramVecDict.cc -c paramVec.h paramDict.cc: param.defs.h echo "Generating dictionary ..." rootcint paramDict.cc -c param.defs.h #--------------------------------------------------- ================================= small_main.cc //-------------------------------------------------- #include "TROOT.h" #include "TRint.h" int Error; //left undefined by Motif extern void InitGui(); // initializer for GUI needed for interactive interface VoidFuncPtr_t initfuncs[] = { InitGui, 0 }; // Initialize the ROOT system TROOT root("Rint","The ROOT Interactive Interface", initfuncs); int main(int argc, char **argv) { // Create interactive interface TRint *theApp = new TRint("ROOT example", &argc, argv, NULL, 0); // Run interactive interface theApp->Run(); return(0); } -- o============o Sending unsolicited commercial e-mail (UCE) to this address Legal Notice is indication of your consent to pay me $120/hour for 1 hour o============o minimum for professional proofreading & technical assessment. Terrence Brannon * brannon@quake.usc.edu * http://quake.usc.edu/~brannon
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:19 MET