Can we write a .root file with a .c code


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: ubuntu
Compiler: Not Provided


I have a C code, compiles with C not C++, is there a way to make the C code create an output .root file with a TTree? I tried adding the ROOT dependencies but that didn’t work.

In principle, a “C++” compiler is expected to compile “C” code, too.

The problem is that the code doesn’t compile when i add the root libraries because it’s in C and root expects .cc. Is there a way to still output a .root file with the C code as is?

Simply rename your source code files from “*.c” to “*.cc”.

Can I create a .root from .c?

You need a “C++” or “python” (or “Go” or “JavaScript”) source code in order to work with ROOT files.

note that I had created a subset of the C++ ROOT API available from C:

so, theoretically, one may also use “C” to work with ROOT files.

also, the “canonical” URL for the “groot” package (a.k.a working with ROOT from Go) is:

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