G++ compilier problem

HI,

I made some class with a rootfile, i was able to plot histograms from the rootfile (ran the script with CINT), now i like to learn how to compile the script but i got the error:
[tomiwa@localhost mot cal]$ g++ analysis1.C -o main.exe -l. root-config --libs --cflags -lRooFitCore -lm -std=gnu++0x

analysis1.C:10: error: expected primary-expression before ‘*’ token
analysis1.C:10: error: ‘chain’ was not declared in this scope
analysis1.C:10: error: expected ‘}’ before ‘;’ token
analysis1.C:11: error: expected constructor, destructor, or type conversion before ‘->’ token
analysis1.C:12: error: ‘chain’ was not declared in this scope
analysis1.C:13: error: expected constructor, destructor, or type conversion before ‘.’ token
analysis1.C:14: error: expected unqualified-id before ‘return’
analysis1.C:15: error: expected declaration before ‘}’ token

please what could be wrong?

Hello, could you attach your analysis1.C? Otherwise, it will be very difficult to answer you.

If you post your macro .C file, we will be able to tell you what is missing. Most often the following things are needed to convert a CINT macro to a compileable program:

  • you need to #include <foo.h> for most ROOT classes foo that you use, so if your macro uses TH1D objects, you need to #include <TH1.h>, if you use gStyle, you need to #include <TStyle.h>, etc.
  • CINT is lazy about enforcing semi-colons at the end of statements, you need to put these everywhere to compile.
  • CINT is lazy about the difference between the “.” operator and “->”, so you have to go back and check if your histograms are actual objects or pointers-to-objects.
  • When run through CINT or ACLiC, you cannot have a “main” function because ROOT is the main function of your program. When you compile separately using g++, you need to write an int main() function that is actually executed when the program runs.

Jean-François