RE:Re: RE:Re: RE:Re: [ROOT] RE:2.25.03: STL

From: Masaharu Goto (MXJ02154@nifty.ne.jp)
Date: Thu Nov 30 2000 - 12:48:45 MET


Hello Matt,

This is interesting. Everything looks fine in the 'tmp' file. 
When you reported the problem, the error message was like this.

>> Error: Can't call vector<const TKey*,__malloc_alloc_template<0> >::size()

So, vector<const TKey*,__malloc_alloc_template<0> > should have been
instantiated. I wonder the vector<const TKey*> was precompiled somehow.
However, in the 'tmp',

>class vector<const TKey*>
> size=0x10 FILE:_vector.h LINE:36
> (tagnum=492,voffset=-1,isabstract=0,parent=-1,gcomp=0,=~cd=f)

Besides, it has size() member function.

>_vector.h        71:1    0 public: vector<const TKey*>::size_type size(void) 
const;

I suppose this should work. 


There is one thing I can think of.  Probably, when you saw the problem,
you used a precompiled library which uses vector<const TKey*>. But, 
someway, you did not add a link to it. For example, you may have 
header file like below.

// badheader.h
#include <vector>
using namespace std;

class TKey {
 public:
};

void f(vector<const TKey*>& x) { } // vector<const TKey*> is referenced

#ifdef __MAKECINT__
#pragma link off all globals;
#pragma link off all functions;
#pragma link off all classes;    // all links to classes are removed

#pragma link C++ class TKey; // only TKey link is added
#pragma link C++ function f;
//#pragma link C++ class vector<const TKey*>; // should have this line
#endif


And done something like

  $ makecint -mk makebad -dl bad.dll -H badheader.h
  $ make -f makebad
  $ cint bad.dll
  cint> .
  cint> vector<const TKey*> a
  cint> a.size() 
  Error: Can't call vector<const TKey*,__malloc_alloc_template<0> >::size()


Now, I see an error like yours.

Thank you
Masaharu Goto



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:38 MET