RE: [ROOT] STL in the class

From: Philippe Canal (pcanal@fnal.gov)
Date: Fri Jul 18 2003 - 00:05:19 MEST


Hi Jedong,

Use:
	#include <vector>
instead of the obsolete
	#include <vector.h>

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Jedong Lee
Sent: Thursday, July 17, 2003 4:25 PM
To: roottalk@pcroot.cern.ch
Subject: [ROOT] STL in the class



Hello,

I am working on v3_05_04e, with KCC4.0.
And I'm having a problem with STL vector.

This is what I get from CINT with the source listed below:

root [0] .L vec.C++
Info in <TUnixSystem::ACLiC>: creating shared library
/mnt/autofs/misc/b0urpc19.a/jdlee/work/root_test/vector/./vec_C.so
"/mnt/autofs/misc/b0urpc19.a/jdlee/work/root_test/vector/./fileonmdDl.h",
line 44: error #864:
          allocator is not a template
  typedef vector<double,allocator<double> >
G__vectorlEdoublecOallocatorlEdoublegRsPgR;
                        ^

1 error detected in the compilation of
"/mnt/autofs/misc/b0urpc19.a/jdlee/work/root_test/vector/./fileonmdDl.cxx".
KCC: Compilation failed.


Is something wrong in my code?

Best,
Jedong


--------------------------------------------------------------------
- file vec.h
--------------------------------------------------------------------
#include <vector.h>
#include "TObject.h"

class vec : public TObject
{
public:
  vec();
  ~vec();

  vector<double> v_;

  ClassDef(vec,1)
};

--------------------------------------------------------------------
- file vec.C
--------------------------------------------------------------------
#include "vec.h"
#include <vector.h>

#ifndef __CINT__
ClassImp(vec)
#endif

vec::vec(){
  v_.push_back(10);
}

vec::~vec(){}

--------------------------------------------------------------------
- file vec_linkdef.h
--------------------------------------------------------------------
#ifdef __CINT__

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

#pragma link C++ class vector<double>;
#pragma link C++ class vec;

#endif

--------------------------------------------------------------------




#################################################################
#################################################################
#################################################################
#####
#####
#####
#################################################################
#################################################################
#################################################################



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:13 MET