Problem with main() and no output root file

By running main.cc and with data.root, I should make analyzetree.root output file, but it seems the code is not working and I don’t see any error. Please give me your insight.
main.cc (2.5 KB)

Please read tips for efficient and successful posting and posting code

ROOT Version: root_v5.34.36
Platform: Windows
Compiler: Emacs


Uploading: data.root…
data.root file too big to be upload.
here is the link * Download example data tree: [root]

One cannot try your code without “particle_tree.h”.
But first, make sure that you do not get any errors or warnings from:

`root-config --cxx --cflags` -Wall main.cc `root-config --libs`

particle_tree.h (2.0 KB)
Here is “particle_tree.h”

Fix your source code.

[...]$ `root-config --cxx --cflags` -Wall main.cc `root-config --libs`
/usr/bin/ld: /tmp/ccykh63G.o: in function `main':
main.cc:(.text+0x1f0): undefined reference to `particle_tree::particle_tree(char const*)'
/usr/bin/ld: main.cc:(.text+0x42f): undefined reference to `particle_tree::GetEntry(long long)'
/usr/bin/ld: main.cc:(.text+0x6db): undefined reference to `particle_tree::~particle_tree()'
/usr/bin/ld: main.cc:(.text+0x78a): undefined reference to `particle_tree::~particle_tree()'
collect2: error: ld returned 1 exit status

I changed the name of analyzetree.cc to main.cc with little bit modifying such as from exe/analyzetree.exe <No. events to analyze>
to
exe/analyzetree.exe data.root analyzetree.root 1000
Here is the raw analyzetree.cc
analyzetree.cc (2.5 KB)

The problem is not the “main” routine but the missing implementations of the “particle_tree” class methods.

analyzetree.tgz (7.5 KB)
here is the everything the file contain except data.root. Is there still error?

In the “analyzetree.cc” file, instead of:

#define particle_tree_cxx
#include "particle_tree.h"

use:

#include "particle_tree.C"

Are there any other things I should know. When I run this code, word usage appear and root quits.

It is not a ROOT macro. It is a “standalone application”. You must learn how to compile and run executables on your system.