However, when I run ./test in terminal, the canvas doesn’t show up.
Please note that if I create a macro
int test2()
{
// same code as test.C
}
and run it with root -l test2.C, then only canvas shows up. But this is not what I want. I want to create an executable test. Any solution to this problem?
If the same macro runs correctly in the interactive prompt, I guess the canvas is also being created and shown when compiled, but note that when the program ends (same as quitting ROOT in interactive mode) the canvas is destroyed; in short, it is shown and closed so fast that you don’t really see it. Try saving the canvas within the macro and then you can look for the output file (like a png, for instance) to check whether it ran correctly; e.g.
I added --glibs into the makefile as you suggested. Also, I am just curious about why this worked with TApplication. Any comment or links for further reading will be a great help, as I will include this part in my main project.