Hi ROOTers
I am trying to add an executable function to the current selected canvas. because I am divided my canvas into some n number of pads, I end up adding the function to every single pad in the following form:
//[LINE#1]
gPad->AddExec("dynamic","GetCoordinates()");
which I find to be the same as doing the following declaration:
//[LINE#2]
gPad->AddExec("dynamic","APIanalyzer::GetCoordinates()");
Now it happens that GetCoordenates is a memeber function of my APIanalyzer class:
When I run this program in ROOT v5.19, my program works fine. However when I run my program in v5.22 or v5.24 I get the following errors:
If I run with LINE#1:
[quote]
*** Interpreter error recovered ***
Error: Function GetCoordinates() is not defined in current scope (tmpfile):1:
*** Interpreter error recovered ***
Error: Function GetCoordinates() is not defined in current scope (tmpfile):1:
*** Interpreter error recovered ***
Error: Function GetCoordinates() is not defined in current scope (tmpfile):1:
*** Interpreter error recovered ***
Error: Function GetCoordinates() is not defined in current scope (tmpfile):1:
*** Interpreter error recovered ***[/quote]
If I run with LINE#2:
[quote]
*** Interpreter error recovered ***
Error: cannot call member function without object (tmpfile):1:
(compiled) 0 void APIanalyzer::GetCoordinates();
Calling : APIanalyzer::GetCoordinates();
Match rank: file line signature
-
0 (compiled) 0 void APIanalyzer::GetCoordinates();
*** Interpreter error recovered ***
Error: cannot call member function without object (tmpfile):1:
(compiled) 0 void APIanalyzer::GetCoordinates();
Calling : APIanalyzer::GetCoordinates();
Match rank: file line signature
-
0 (compiled) 0 void APIanalyzer::GetCoordinates();
*** Interpreter error recovered ***
Error: cannot call member function without object (tmpfile):1:
(compiled) 0 void APIanalyzer::GetCoordinates();
Calling : APIanalyzer::GetCoordinates();
Match rank: file line signature
-
0 (compiled) 0 void APIanalyzer::GetCoordinates();
*** Interpreter error recovered ***[/quote]
Those errors are print out as soon as a mouse action is detected in any of my pads. I was able to figure out (based on the error description) that the AddExec is adding a function which is linked to an object. Because I do not specified the object, hence I get the error. I was able to solve the problem by declaring my function static:
This indeed solve the problem however it does not work with my current program architecture. Is there a way to do the proper linkage of an executable function (aka member function to an object) to a Pad?
I try the following but it did not work:
Thanks for your comments…
Kris