Error creating vector with user-defined type

Hi everybody,

I made a standard analysis function with MakeClass, which includes the following vector and its type:

#include <vector>
#include <algorithm>

struct Hit_t {
  double E, r, phi, z;
  Hit_t (double E = 0, double r = 0., double phi=0., double z=0.):
    E ( E ),
    r( r) ,
    phi( phi ),
    z( z )
  {}
};

and then in later in the .cc file:

When I try to load it into memory with .L, I get the following error messages:

In file included from /home/aguilar/geant4/Reconstruction.proj/AutoDict_random_access_iterator_Hit_t_long__cxx_ACLiC_dict.cxx:16:
/home/aguilar/geant4/Reconstruction.proj/AutoDict_random_access_iterator_Hit_t_long__cxx_ACLiC_dict.h:44: error: expected initializer before '<' token
/home/aguilar/geant4/Reconstruction.proj/AutoDict_random_access_iterator_Hit_t_long__cxx_ACLiC_dict.cxx:57: error: expected unqualified-id before '<' token
/home/aguilar/geant4/Reconstruction.proj/AutoDict_random_access_iterator_Hit_t_long__cxx_ACLiC_dict.cxx:57: error: expected `,' or `...' before '<' token
/home/aguilar/geant4/Reconstruction.proj/AutoDict_random_access_iterator_Hit_t_long__cxx_ACLiC_dict.cxx:58: error: ISO C++ forbids declaration of `parameter' with no type
/home/aguilar/geant4/Reconstruction.proj/AutoDict_random_access_iterator_Hit_t_long__cxx_ACLiC_dict.cxx: In function `ROOT::TGenericClassInfo* ROOT::GenerateInitInstanceLocal(int)':


... blah blah blah, lots more of the same...

/home/aguilar/geant4/Reconstruction.proj/AutoDict_random_access_iterator_Hit_t_long__cxx_ACLiC_dict.cxx:83: warning: 'void ROOT::random_access_iteratorlEHit_tcOlonggR_Dictionary()' defined but not used
g++: /home/aguilar/geant4/Reconstruction.proj/AutoDict_random_access_iterator_Hit_t_long__cxx_ACLiC_dict.o: No such file or directory
Error in <ACLiC>: Compilation failed!

I’m pretty confused; rooting (hah!) around online doesn’t seem to help much. I guess my confusion stems from the fact that the first reported error is in the file automatically generated by AutoDict, rather than in anything I wrote myself.

Can anyone point me in the right direction? I can attach all of my code if that would help.

Thanks,
Jonathan

Could you:
-indicate which version of root you use?
-post the shortest possible running-script reproducing the problem?

Rene

Hi,

To avoid the problem, rather than interpreting your code (.L myscript.cc), compile it (.L myscript.cc+).

Cheers,
Philippe.