Error: function definition is not allowed here void function() {

The content of the file must be valid c++. you cannot define functions inside functions in c++ :sweat_smile:

The way macros work is that, if your filename is test2.C, running your macro in root is (roughly) equivalent to executing test2().