Compilation fails including .hpp files

Hello everyone,
so I’d like to draw some bayesian blocks histograms and the only algorithm that was already implemented in C++ I could find is this one on GitHub.

It really seems to suit what i need, so I downloaded the zip file and copied the headers file (“baeysian_blocks.hpp” and “baeysian_blocks_root.hpp”) in the “include” folder where all the others include files for root are.
But when I compile my code I get an error

./Events.h:11:10: fatal error: ‘baeysian_blocks.hpp’ file not found
#include “baeysian_blocks.hpp”
^
1 error generated.

Sorry if this may sound dumb, but i’m not really an expert at programming, and i could really use some help.
Thanks in advance.


_ROOT Version: 6.11/02
Platform: OS X 10.11.6
Compiler: gcc


Try something like this:
$(root-config --cxx --cflags) -o YourExecutable YourSourceCode.cxx $(root-config --libs)

Thanks for the very quick reply. I tried but it doesn’t seem to work, I get exactly the same error.

P.S.
I omitted in the first post but i usually compile with the command

g++ `root-config --cflags` `root-config --libs` Events.C -o eve

Try (see if the listed compiler and include directory is what your expect): root-config --cxx --cflags

Yeah, it’s exactly the folder where I copied the .hpp files. It’s the same folder where all the ROOT .h files are located.

Try (see if these files are “readable” to you):
ls -al $(root-config --incdir)/baeysian_*.hpp

Ok, not really sure of what I’m doing. In which directory should I wirte the command you gave me? I get an output like

ls -al $(root-config --incdir)/baeysian_* .hpp
-bash: root-config: command not found
ls: /baeysian_*.hpp: No such file or directory

It seems you have not setup your ROOT. You first need to, e.g.:
source /full/path/to/your/ROOT/bin/thisroot.sh

Ok, now i did set up my ROOT. Tried to re run the command you gave me and i get

ls: /Users/Zenith/root/include/baeysian_*.hpp: No such file or directory

or

ls: /Users/Zenith/root/include/baeysian_blocks_root.hpp: No such file or directory

Instead, if I try something like

ls -al $(root-config --incdir)/*.hpp

i get

-rwxr-xr-x@ 1 Zenith staff 6842 11 Giu 08:50 /Users/Zenith/root/include/bayesian_blocks.hpp
-rwxr-xr-x@ 1 Zenith staff 3182 15 Ott 11:59 /Users/Zenith/root/include/bayesian_blocks_root.hpp

So, it’s “baeysian” against “bayesian” (the winner takes it all).

Thank you very much, thanks for the lot of trouble!