Error to include root header files in C++

when I run this file by:
$ ./a.out

It thows this:
Info in TCanvas::MakeDefCanvas: created default TCanvas with name c1
Error in TROOT::WriteTObject: The current directory (RootApp) is not associated with a file. The object (f1) has not been written.
hello world

But I could not find the file or it does not pop up any window showing the graph.
If you can tell me how to do those things.
Sorry sir this is pre-eliminary things, but if you tell me that will be really helpful as I am newbie
Thank you, sir.