Illegal Pointers and Interpreting ROOT error codes

Hello, many times in my work I will see the following error code:

Error: illegal pointer to class object infile 0x0 5 GEM_zoffset.cpp:35:

The lines of code in question are

TString * s_infile = Form("histograms_run%d.root",nofile);
TFile * infile = TFile:Open(s_infile, "READ");
//TFile infile("histograms_run1483.root");
 
TTree * t_hits = infile.Get("T_hits");
//TTree * t_hits = (TTree*)infile->Get("T_hits");
//TTree * t_hits;  gDirectory->GetObject("T_hits",t_hits);

I’ve used this method of reading a ROOT tree in many codes, but this time it just won’t compile. The only difference with this file is that these lines are written above the main program, whereas usually they’re written within the main program’s brackets.

I was wondering if a) Someone might know what I’m doing wrong, and/or b) Where I can find error code documentation so I can understand the numbers 0x0 5?

Thank you very much!

You declare your TString s_infile as a pointer. This is possible, but then you have to treat it like a pointer of course. In your code just remove the * after TString and it should work.

Wow, what a silly mistake. Thank you!