Hello,
First of all let me state that I am a complete newbie about compiling and linking any C++ code. “Build” has always been a black magic command to me, which has always worked in a simple and blackbox-y way inside IDEs for other programming languages. Dealing with compiling C++ code has a completely different feeling to it; it seems like it requires some advanced knowledge about how it works in a deeper level, which I surely don’t have.
I have tried very hard (and finally succeeded) to compile a ROOT macro with an external compiler (CMake, g++) and run it as an application, outside the ROOT command line. Never have I been able to do so while making my application show in an effective way any graphics (TCanvas, TBrowser etc), even when using root-config
to link all the graphic libraries. I have read on this forum that this is one of the reasons why you shouldn’t use your own main program, and I have read multiple times that writing a main function which uses ROOT code is just something that you shouldn’t do, and you should always write macros that can run on the ROOT command line.
On the other hand, the real reason why I had to compile ROOT code outside ROOT is to be able to use an IDE to get all of its useful features - auto-completion, function templates, debugging, and in general all the coding aids an IDE has to offer. Among the latter, being able to debug and run a program from inside the IDE has many advantages, among which breakpoints, debugging, and also just the possibility to run the code without having to summon a different terminal window and to type the command root -l mymacro.C
.
However, it does seem that using the IDE this way (ie using it to debug, compile, and run the ROOT macro) is a very complicated process and, as I said above, it doesn’t offer all the features ROOT has to offer (the GUI doesn’t work properly), and, in general, it is very discouraged by the ROOT developers.
My question is very simple: am I missing something, is my understanding flawed, or else why is all of this so bad?
(Please note that my question has no polemic nuance, I am genuinely interested in what I am doing wrong and how can I improve my ROOT experience.)
Thank you all in advance!