Problem with macro and stl map containing TString, TLine

Dear all,

I have a Macro that should use an stl map :

#include “TLine.h”


map<TString, TLine> lines;

And the loader is as this (taken from other posts on the forum) :

#include “TLine.h”

cout << “create dico” << endl;
#pragma link C++ class pair<TString,TLine>+;


When using it in root ( .x script2.C ) , I get the following :

I-TUnixSystem::ACLiC: creating shared library /home/bvonhall/dev/modulesSVN/modules/amoreQA/ In file included from /home/bvonhall/dev/modulesSVN/modules/amoreQA/AutoDict_allocator_pair_const_TString_TLine____cxx_ACLiC_dict.cxx:16: /home/bvonhall/dev/modulesSVN/modules/amoreQA/AutoDict_allocator_pair_const_TString_TLine____cxx_ACLiC_dict.h:45: error: `TLine' was not declared in this scope /home/bvonhall/dev/modulesSVN/modules/amoreQA/AutoDict_allocator_pair_const_TString_TLine____cxx_ACLiC_dict.h:45: error: template argument 2 is invalid /home/bvonhall/dev/modulesSVN/modules/amoreQA/AutoDict_allocator_pair_const_TString_TLine____cxx_ACLiC_dict.h:45: error: template argument 1 is invalid /home/bvonhall/dev/modulesSVN/modules/amoreQA/AutoDict_allocator_pair_const_TString_TLine____cxx_ACLiC_dict.h:45: error: ISO C++ forbids declaration of `G__allocatorlEpairlEconstsPTStringcOTLinegRsPgR' with no type (...)

It must be something trivial, but I can’t find out what is the problem. It works if I replace TLine with TString or TObject.

Thanks in advance for your help.
script2.C (117 Bytes)
loader.C (155 Bytes)


see attached scripts. Running .x script2.C works for me.

Cheers. Axel.
script2.C (181 Bytes)
loader.C (129 Bytes)

Thanks Axel,

My mistake was to to do

#pragma link C++ class pair<TString,TLine*>+; instead of #pragma link C++ class map<TString,TLine*>+;
(Note that “pair” was replaced by “map”)



not only - your files also had statements outside any function scope.

Cheers, Axel.