Dear experts,
I have a function [1] in an external file func.cc. I parse this function to my main.cc file, but when I compile with [2], I got the error message [3]. Do you know what is wrong?
PS: so far, I do not have this problem with histogram.
Regards
[1] func.cc
void setaxis(TGraph *g1, TGraph *g2, int size){ // train, test
double g1max = TMath::MaxElement(size, g1->GetY());
double g2max = TMath::MaxElement(size, g2->GetY());
...
g1->SetLineWidth(2);
g2->SetLineWidth(2);
}
[2] Makefile
ROOTFLAGS = $(shell root-config --cflags)
ROOTLIBS = $(shell root-config --libs)
CXXFLAGS = -std=c++0x -I$(CMSSW_RELEASE_BASE)/src/
TMVAFLAGS = -lTMVA -lTMVAGui
GCCFLAG = -Wall -Wextra
all:$(Target)
do.exe: main.cc ../../myfunc.cc
g++ -o $@ main.cc $(ROOTFLAGS) $(ROOTLIBS) $(CXXFLAGS) $(TMVAFLAGS) $(GCCFLAG)
[3] Error message
../../func/myfunc.cc: In function 'void setaxis(TGraph*, TGraph*, int)':
../../func/myfunc.cc:421:44: error: invalid use of incomplete type 'class TGraph'
double g1max = TMath::MaxElement(size, g1->GetY());
^
In file included from /cvmfs/cms.cern.ch/slc6_amd64_gcc530/cms/cmssw/CMSSW_8_0_20/external/slc6_amd64_gcc530/bin/../../../../../../lcg/root/6.06.00-ikhhed4/include/TMVA/MethodCuts.h:50:0,
from main.cc:21:
/cvmfs/cms.cern.ch/slc6_amd64_gcc530/cms/cmssw/CMSSW_8_0_20/external/slc6_amd64_gcc530/bin/../../../../../../lcg/root/6.06.00-ikhhed4/include/TMVA/MethodBase.h:75:7: note: forward declaration of 'class TGraph'
class TGraph;
^
In file included from main.cc:25:0:
../../func/myfunc.cc:422:44: error: invalid use of incomplete type 'class TGraph'
double g2max = TMath::MaxElement(size, g2->GetY());
^
In file included from /cvmfs/cms.cern.ch/slc6_amd64_gcc530/cms/cmssw/CMSSW_8_0_20/external/slc6_amd64_gcc530/bin/../../../../../../lcg/root/6.06.00-ikhhed4/include/TMVA/MethodCuts.h:50:0,
from main.cc:21:
/cvmfs/cms.cern.ch/slc6_amd64_gcc530/cms/cmssw/CMSSW_8_0_20/external/slc6_amd64_gcc530/bin/../../../../../../lcg/root/6.06.00-ikhhed4/include/TMVA/MethodBase.h:75:7: note: forward declaration of 'class TGraph'
class TGraph;