Error to include root header files in C++

See this post for why the graph does not show (you need to create a TApplication object and call app.Run() before the end of the main function so that the program doesn’t just exit when it reaches the end of main.

In general you might want to check out the ROOT primer, in particular the section about Interpretation and compilation of ROOT programs.

I hope this helps!
Enrico