How to make a class in C++ work in ROOT, instead

Can anybody tell me how to make this code work in ROOT?

myclass2.cpp (371 Bytes)

My second question is about files with .C extension. Can they only for loading in ROOT but not like standalone codes to run?


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

Replace “main” with “myclass2”, then try root [0] .x myclass2.cpp

For C++ source code, you can use e.g. “.cxx”, “.cpp”, “.C”.

ı forgot to change this main part. You are right. However, it still doesn’t work.

My error: warning: cannot find function ‘myclass2()’; falling back to .L

It’s kind of telling me that ı can only load this but not run by using .x myclass2.cpp++

Why is it doing this for .cpp++ option?

ROOT 6 Primer -> ROOT Macros
ROOT 6 User’s Guide -> The C++ Interpreter Cling

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