Function is declared but not defined

Hi So I am making a program looping through different TTree. I have some problems calling a Analysis.C macro (it is basically the standard MakeClass file with some edits)
It keeps complaining that the the function Analysis() and ~Analysis() is declared but not defined.
But they are in the header file attached.
I greatly appreciate any help!

root [0] .x GenerateAnalysis.C
Error: Analysis() declared but not defined GenerateAnalysis.C:42:
Error: ~Analysis() declared but not defined GenerateAnalysis.C:42:
*** Interpreter error recovered ***
Abs Directory: /Users/Documents/MadGraph/MG5_aMC_v2_2_3/PROC_New_Resonances_UFO_0/Events/mass500/tag_2_pythia_lhe_events.rootAnalysis Name: :Analysis500T: 0x7fd7fd771ae0root [1]

// GenerateAnalysis.C

#include <stdio.h>
#include “TFile.h”
#include “TTree.h”
#include “TSystem.h”
#include “Analysis.h”
using namespace std;
void GenerateAnalysis(void);

void GenerateAnalysis(void)

string Dr="/Users/Documents/MadGraph/MG5_aMC_v2_2_3/PROC_New_Resonances_UFO_0/Events/mass";
string MassNumber[20]={“250”,“500”,“1000”,“1500”,“3000”,“3500”,“4000”,“4500”,“5000”,“5500”, “6000”,“6500”,“7000”};
string FileName="/tag_2_pythia_lhe_events.root";
string AbsDirectory;
string AnalysisName;
// int i=1;
for (int i =0; i<13; i++)
cout<<"Abs Directory: "<<AbsDirectory;
cout<<“Analysis Name: :”<<AnalysisName;

    //.L Analysis.C;
    TFile *f = new TFile(AbsDirectory.c_str());
    TTree *T;

    f ->GetObject("LHEF",T);
    cout<<"T: "<<T;

    Analysis t;


Analysis.h (10.3 KB)


The definition of Analysis() and ~Analysis() is within an ifdef statement:

#ifdef Analysis_cxx

So as long as Analysis_cxx is not defined, the definition of Analysis() and ~Analysis() is not existent. You could try adding a

#define Analysis_cxx

somewhere at the top of Analysis.h, or remove the #idef Analysis_cxx […] #endif statements, but I’m not sure if this would lead to some unexpected side effects. There is probably a good reason why there is this #ifdef statement :wink:.


1 Like