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

From: Alexander Mann <amann_at_uni-goettingen.de>
Date: Fri, 1 Jul 2011 15:20:47 +0200

Hi Philippe,

I see, thanks!

cu,
Alexander

On 07/01/2011 03:06 PM, Philippe Canal wrote:
> Hi Alexander,
>
> CINT is more sensitive to white space (or lack there of) as it should.
> Instead of:
>
> void vechist(std::vector<TH1*>a) {
>
> use
>
> void vechist(std::vector<TH1*> a) {
>
> (which anyway is more human readable :))
>
> Cheers,
> Philippe.
>
> On 7/1/11 4:00 AM, Alexander Mann wrote:
>>
>> 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
>>
>>
>> ---------------------- [1] -----------------
>>
>>
>> #include <iostream>
>> #include <vector>
>> #include "TH1.h"
>>
>> void vechist(std::vector<TH1*>a) {
>> std::cout << a.size() << std::endl;
>> }
>>
>>
>>
>> ---------------------- [2] -----------------
>>
>> $ 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
>>
>>
>> --------------------- [3] -----------------
>>
>> 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 - 15:20:57 CEST

This archive was generated by hypermail 2.2.0 : Sat Jul 02 2011 - 11:50:01 CEST