Root gives an error for this macro but it runs fine in codeblocks

The code I have attached is just something I wrote in codeblocks, and it runs fine there. I thought to check if I can run it in root too (and I assumed that it should work), but when I try to run it, root gives the error:

cannot open file “random” montecarlo1.cpp:4:
*** Interpreter error recovered ***

Can someone see why I am getting the error and how I can resolve it? The code is attached.

montecarlo1.cpp (1.5 KB)

ROOT Version: 5.34/38
Platform: Ubuntu
Compiler: Not Provided


There is no ROOT involved.

BTW. “random” needs at least C++11. Also, rename “function” into something else (you have a name clash with the standard C++ “template<typename _Signature> class function;”).

1 Like

Yes, there is no ROOT involved. Just wondering if it did not run because I am using an older ROOT version. Could it be possible? Cause I was under the impression that any cpp file can be used as a macro and can be run in root. Is it not true?