vector<TH1D*> in compiled code

Can someone let me know why ROOT won’t compile code that creates a std::vector<TH1D*>? I know there are some rough edges with ROOT and the STL container classes, but what I don’t know is how to go about fixing them :smiley:

Here’s the offending code:
 vector<TH1D*> ux_wf (40, 0);

And the resulting errors are attached.

The errors were generated with ROOT version 5.34 with scientific linux.
root_errors.txt (1.97 KB)

Any chance you could also post your Makefile or compilation command? Likely it’s something wrong in that step. I use vector<TH1*> all the time with no problems in compiled code, so it’s not a general problem.

I’m trying to compile with .L myfile.cpp+

I’ve included the vector class

#include <vector> #include <TH1D> using std::vector;

[quote=“fenkerbb”]I’m trying to compile with .L myfile.cpp+

I’ve included the vector class

#include <vector> #include <TH1D> using std::vector; [/quote]

I think the problem is that

#include <TH1D> should be

The error message invalid conversion from ‘int’ to ‘TH1D*’

is a hint that the compiler does not recognize the class TH1D - this is because it never finds the header file in which the class is defined.

Also, the “rough edges” of ROOT do not effect the actual compiling of code. That step is done with a real C++ compiler whenever you use a makefile or ACLiC. It’s only the dictionary generation step (or interpretation) that may refuse to parse valid C++ code.