rename your function to e.g. prova() (instead of main()), save your source into prova.C, start ROOT, and simply do:
root [0] .x prova.C+
No need to compile or link anything (or fix the issue with missing graphics) - ROOT will take care of it.
prova.C is a source file. “Macro” is just a misleading word - prova.C+ will invoke your compiler and linker and generate a shared library. There is NO difference in performance nor code validity checks to what you are trying to do.
If you really do need a stand-alone binary: could you tell us your use case? You will need a TApplication object and you will need to keep your program running, or all windows will vanish before they show up (see TVirtualPad::WaitPrimitive()). But again: don’t do it. Use the “+”.