Dear ROOTers,
My apologizes in advance, because this subject has been already discussed in previous talks “here” and “here 2”, but I did not really understand what might be wrong in my case. First, I made a macro and then compiled with CINT as “.L macros/CSpec.C++” but in order to make it cleaner and add other features I would need to go for a compiled version.
You can find in attachment an example of something that I want to do:
- Draw a TCanvas
- Run an AddExec on it without to quit
Files:
CSpec.cxx (4.1 KB)
CMakeLists.txt (3.7 KB)
In order to compile and produce the executable:
cmake …/
make
./CSpec
The AddExec is just supposed to draw a vertical under the mouse cursor when typing “b”.
As I red in previous talks, I declared the function as static void myexec(), but when I try to interact with the TCanvas, I get the following error:
input_line_82:2:3: error: use of undeclared identifier ‘myexec’
(myexec())
I also tried to remove the line:
theApp->Run();
and modify the function void exec() as:
for(;;){
myexec();
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
}
//gPad->AddExec(“myexec”,“myexec()”);
in order to make the job of AddExec, but it cannot interact with the TCanvas and nothing happens.
Any comments and ideas are very welcome.
Cheers,
Christophe