Qt as IDE for ROOT

Hello everyone,

I am just starting with ROOT, so I guess you all know how challenging can be, at least, it’s been my case! I was wondering if someone has tried to use Qt as an IDE for ROOT and if yes, could you please shed some light on how to do this process??

I’d appreciate all your possible help!!
Thanks a lot in advance!

Art2

Qt is a framework for many things, but it is not an IDE.

Are you talking about “Qt Creator”? If you have a working cmake project, you can just open the CMakeLists.txt and it works perfectly (I don’t remember, probably I had to add an include path for root or source thisroot.sh first?) Anyway, it works.

You can also try KDevelop 5. It is also Qt based.

If you want non-Qt IDEs, try Visual Studio Code (with C++ IntelliSense extension) and/or Eclipse (with CDT).

It is up to you what you prefer. You need to know your editor anyway.

Usually the only thing you need to do is point the IDE to the ROOT header file include path.

Hi!

Thanks a lot for your reply. Sorry for not being precise, yes, I mean Qt Creator. I have worked with Qt creator before, coding own programs, and I had to include some external libraries and includes in the project. However, Root uses a large number of libraries and to include them by hand doesn’t look reasonable. I have a local installation of Root, so I guess I have to give both, the include and the library path.

Can you tell me how to do this …

Usually the only thing you need to do is point the IDE to the ROOT header file include path.

for all the root libraries and includes?? is this even possible??

Thanks!

Art2

Hi Arturo,
after installation, all libraries are in $ROOTSYS/lib and all headers are in $ROOTSYS/include
where $ROOTSYS is the path to your ROOT installation.

Hi,

Thank for the reply, I am aware of this, by doing
root-config --libs
and
root-config --cflags I can find where they are. The question would be, how to let Qt Creator know where they are. Any idea?

Thanks once more!

Hi,
this is more a QtCreator question at this point, but a quick google search brings up the editor’s guide:
http://doc.qt.io/qt-5/third-party-libraries.html

and a stackoverflow answer:

It seems you need to edit your *.pro project file to add the relevant directories to the INCLUDEPATH and LIBS variables.

Hope this helps.
Enrico

I do it like this:

  1. Create a new plain C++ project with CMake
  2. Quit QtCreator
  3. source thisroot.sh
  4. mkdir project/cmake/Modules directory
  5. copy root/etc/cmake/FindROOT.cmake to your cmake/Modules directory
  6. Modify CMakeLists, add something like this
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wpedantic -Wextra")

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
include(FindPkgConfig)

find_package(ROOT REQUIRED)
include_directories(SYSTEM ${ROOT_INCLUDE_DIR})

And for your executable, add target_link_libraries(your_executable ${ROOT_LIBRARIES})

Then restart qtcreator from the shell where you have already sourced thisroot.sh and be happy.

Hi again,

It worked, I mean, now it recognizes everything and does the build and debug without problems. However, I think there is still something I’m missing. I’m not getting any “ROOT output”, like the plots. I used this code here https://root.cern.ch/doc/master/candledecay_8C.html and as I said, everything worked except by the fact that nothing is shown.

I have the feeling that at some point I am not calling ROOT, like @behrenhoff quoted in his post. Do you have an idea?

Thanks to both!

Hi,
maybe this answer can help:

Cheers,
Enrico

1 Like

Hi Enrico,

It worked!!! Thanks a lot!!!

Cheers,

Art2

You can check out here how to setup QtCreator IDE to build and debug ROOT scripts here:

hello, Eclipse is a also an IDE. Eclipse is a mighty open framework. About 20 years ago IBM sacrified it own IDE and put some componente into IDE. Now my question, does anybody know, whether Eclipse is the strategy of the root development at CERN?
BR Ralf

Hi,
virtually every ROOT developer and user has a different setup, you can use Eclipse just as you can use any other IDE or editor.

Cheers,
Enrico

Hi,
thx. Ok this means probably that all IDE which somehow fit are very good adaptable. CERN has no preference.
We are interested to use also python. Eclipse allows to use python and C++ plugins. Therefore it seems the first choice. Is there a visible Eclipse community? I found only an old thread from 2009 about pyroot in Eclipse. BR Ralf