I am trying to generate a dictionary for the container std::map<unsigned int, unsigned int>. I have attached three files:
STLDictionary_LinkDef.h
STLDictionary.cc
STLDictionary_Makefile (I had to upload it as STLDictionary_Makefile.txt because the forum didn’t like the _Makefile extension)
To generate the dictionary, I execute
mv STLDictionary_Makefile.txt STLDictionary_Makefile
make -f STLDictionary_Makefile
I am running on CERN LXPLUS, using CMSSWv5.2.4.patch3 and ROOT v5.32/00 (branches/v5-32-00-patches@42372). The CINT interpreter version is 5.18.00. When I execute make, I get the error
In file included from STL_dict.cc:17:0:
STL_dict.h:54:9: error: ‘map’ does not name a type
make: *** [STLDictionary.so] Error 1
Can any of the experts reproduce this problem, or let me know what mistake I’m making?
Thank you for the code modification. It fixed the problem.
Now I’m trying to generate an STL dictionary for a more complicated object, map<string, pair<string, string> >. The dictionary is generated okay (the code doesn’t crash). However, I run into trouble when I try to use these objects in a ROOT macro. Attached are two files:
STLDictionary_LinkDef.h
formatPlots.C
To build the dictionary, I use the exact version of STLDictionary.hh and STLDictionary_Makefile that you gave me, and execute
make -f STLDictionary_Makefile
This runs without error. However, when I try to run the attached ROOT macro with
root -l -b -q formatPlots.C
I get the error
Processing formatPlots.C…
Error: can not call private or protected function formatPlots.C:21:
STLDictionary.so -1 pair<string,string>& pair<string,string>::operator=(const pair<string,string>&);
Calling : pair<string,string>::operator=(pair<string,string>);
Match rank: file line signature
Any idea what’s causing that error? It seems that the operator= of pair<string, string> is being built as private or protected when it needs to be public in order to use it to fill the map.