Re: ostream,..

Selim Issever (issever@mail.desy.de)
Wed, 18 Feb 1998 08:22:57 +0100 (MET)


On Tue, 17 Feb 1998, Fons Rademakers wrote:
]Hi Selim,
]
] did you export operator<< via your LinkDef.h? For friend functions you
]have to add lines like:
]
]#pragma link C++ function operator<<(ostream&,const TRange&);
]
]to your LinkDef.h file, since friends are no class member functions
]they will not be automatically included when TRange is exported.
]
]Cheers, Fons.

Good Morning Genevaaa,..;)

Thanks for the help,.. I did what was requested, but not correctly as it
seems and would need further assistance,..
My files are as follows:

>>> TRange.H ====================================
#ifndef TRange_H
#define TRange_H
#include <iostream.h>
#include "/usr/local/root/include/TObject.h"

class TRange : public TObject {
public:
[...delete...]
friend ostream& operator<< (ostream& AStrm, const TRange& ARange) {
AStrm << "hello";
return AStrm;
}
ClassDef(TRange, 1)
};
#endif
<<< ----------------------------------------------
>>> LinkDef.h ====================================
#ifdef __CINT__

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

#pragma link C++ class TRange;
#pragma link C++ function operator<<(ostream&,const TRange&);

#endif
<<<------------------------------------------------
>>> Makefile ======================================
[...delete...]
LIBNAME1 = TRange
DICTNAME1 = $(LIBNAME1)Dict
$(LIBNAME1).o: $(LIBNAME1).H $(LIBNAME1).C
$(CXX) $(CXXFLAGS) -c $(LIBNAME1).C -o $(LIBNAME1).o
$(DICTNAME1).C: $(LIBNAME1).H $(LIBNAME1).C
@echo "Generating $(LIBNAME1) dictionary ..."
@rm -f $(DICTNAME1).*
@rootcint -f $(DICTNAME1).C -c -p $(LIBNAME1).H LinkDef.h
<<<------------------------------------------------

I included the -p option after I was requested to do so, but still get the
following error message:

>>> stdout/err ====================================
Generating TRange dictionary ...
Error: Unexpected EOF G__fgetstream():2 FILE:LinkDef.h LINE:4
Error: Unexpected EOF G__fgetc() FILE:LinkDef.h LINE:4
make: *** [TRangeDict.C] Error 1
<<<------------------------------------------------

S E L I M I S S E V E R
DESY-F15, Notkestr. 85, 22603 Hamburg, Germany; Tel/Fax: 040 8998-2843/4033
http://www.physik.uni-dortmund.de/~issevers; selim.issever@desy.de
Ete kemige burundum, Yunus diye gorundum. Yunus Emre