Error with name of the script

Hi , i’m a cernroot beginner and i’m having trouble with a (maybe stupid) name question. For example, in Linux (i use Gedit to write my scripts), i’ve this file “test.C”:

int test()

{

printf(“TEST \n”);

return 0;

}

and, if i run “root test.C”, it works:

root [0]

Processing test.C…

TEST

(int) 0

but if i change the name in the script (not the name of the file in .C) as follows and i run “root test.C” it doesn’t work:

int main()

{

printf(“TEST \n”);

return 0;

}

this is the error

root [0]

Processing test.C…

warning: Failed to call test() to execute the macro.

Add this function or rename the macro. Falling back to .L.

Why this happens? And how could i solve this?

Thanks!!!

Read all (using main() is also discussed).

Welcome to the ROOT forum

When you do:

root test.C

root will look at the test() method inside the file test.C as explained in the Manual.

ROOT Primer → ROOT Macros