How to run the root inside another program?

How to run the root inside another program?

ROOT Version: 6.19/01
Platform: Ubuntu
Compiler: Not Provided

ROOT -> Frequently Asked Questions -> Can I integrate ROOT into my CMake build?
ROOT -> How To -> Developer’s Tips -> Integrate ROOT into my project with CMake
ROOT -> How To -> Developer’s Tips -> Running ROOT tests

I didn’t understand.

what do you mean exactly with “running root inside another program”? You can use ROOT as any other C++ library, #include the headers, pass the right flags to the linker and compile a C++ program that uses ROOT. Is that what you mean? If yes, the simplest compiler invocation is g++ -o myprogram myprogram.cpp $(root-config --libs --cflags).

To integrate ROOT with an existing C++ project that uses cmake as the build system, you can follow Wile’s links.


Maybe this is what I need. What should I write instead of --libs and --cflags?

–libs and --cflags :smiley: that’s the full command, assuming you have a working ROOT installation

ROOT Forum -> Search -> “root-config --cxx”

I added “$ (root-config --libs --cflags)”, g ++ gave errors “… was not defined in this scope” on the root function

That’s a proper compiler error. It means you are missing the definition for whatever symbol the compiler is complaining about. Most probably you need to #include the corresponding header. You can check the reference guide for the name of the headers containing the classes/objects you need.


Yes, I think I figured it out, thanks :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.