Symbol g is not defined in current scope


ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Hello!
I am new to Root i a have some trouble with this file. When i try to run it in root there is an error: symbol g in not defined in current scope. How can i fix it and why it isn’t working?
Thank you for you help.

TCanvas *c= new TCanvas("smth","smth", 10,20,200,400);
	
	Double_t x[] = {26,38,41,42,44,47,48,51,53,55,58,59,61,63,65,67,69,71,73,75};
	Double_t y[] = {1.2424e+012,7.7958e+010,3.4829e+010,1.70323e+010,9.3366e+009,5.31988e+009,3.26232e+009,1.97405e+009,1.2783e+009,9.0085e+008,6.9448e+008,5.65103e+008,5.007e+008,4.25601e+008,3.43924e+008,2.870635e+008,2.4560e+008,2.11328e+008,1.17601e+008,1.161475e+008}

TGraph *g = new TGraph(20,x,y); 
gStyle->SetOptFit(1);
	gStyle->SetOptStat(0);
	g->SetMarkerStyle(21);

You are missing a “;” character in the end of the “Double_t y[] …” line.

BTW. When you post “source code” or “output” here, do remember to enclose them into two lines which contain just three characters ``` (see how your post has been edited above).

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.