vector<TH1*> works on command line, but not in macro?

From: Alexander Mann <amann_at_uni-goettingen.de>
Date: Fri, 1 Jul 2011 11:00:05 +0200

Hi,

I find that vector<TH1*> works on the command line, but not in my macro. I have a simple test macro [1]. Trying to run this on the CINT command line fails with

> Warning: Unknown type 'std::vector<TH1*>a' in function argument
handled as int vechist.C:5:

Compiling with .L vechist.C+ also fails [3]. On the other hand defining std::vector<TH1*>s on the CINT command line seems to work [2].

Therefore there should be a simple way to make this work in my macro as well, but right now I don't see it...

Thanks for your help,
Alexander

#include <iostream>
#include <vector>
#include "TH1.h"

void vechist(std::vector<TH1*>a) {

   std::cout << a.size() << std::endl;
}

$ root vechist.C
root [0]
Processing vechist.C...
Warning: Unknown type 'std::vector<TH1*>a' in function argument handled as int vechist.C:5:
Error: Function vechist() is not defined in current scope :0: *** Interpreter error recovered ***
root [1] #include <vector>
Note: File "vector" already loaded

root [2] std::vector<TH1*>a
root [3] a.push_back(new TH1F())
root [4] a.size()

(const unsigned long)1

root [0] .L vechist.C+
Info in <TUnixSystem::ACLiC>: creating shared library /net/ph2/auto/home/mann/Code/ROOT/./vechist_C.so /net/ph2/auto/home/mann/Code/ROOT/vechist_C_ACLiC_dict.cxx: In function ‘int G__vechist_C_ACLiC_dict__0_1391(G__value*, const char*, G__param*, int)’:
/net/ph2/auto/home/mann/Code/ROOT/vechist_C_ACLiC_dict.cxx:70: error: conversion from ‘int’ to non-scalar type ‘std::vector<TH1*, std::allocator<TH1*> >’ requested
g++: /net/ph2/auto/home/mann/Code/ROOT/vechist_C_ACLiC_dict.o: No such file or directory
Error in <ACLiC>: Compilation failed! Received on Fri Jul 01 2011 - 11:00:14 CEST

This archive was generated by hypermail 2.2.0 : Fri Jul 01 2011 - 17:50:01 CEST