Home | News | Documentation | Download

How to include Math::Interpolator?

Hi fellow ROOT users!

I think I have an issue finding the correct Header file. Here’s what I’m trying to use:

#include <iostream>
#include "TMath.h"
#include "Math/Interpolator.h"

void interpolate()
{
	std::vector<double> vec_a {0., 3., 16.};
	std::vector<double> vec_b {1., 9., 24.};
	
	Math::Interpolator* my_interpolator = new Math::Interpolator(vec_a, vec_b, ROOT::Math::Interpolation::kLINEAR);
	
	std::cout << "5 -> " << my_interpolator->Eval(5) << std::endl;
}

When trying to compile, i.e. root [0] .L interpolate.C+, I receive the error message

In file included from input_line_12:9:
././interpolate.C:10:2: error: use of undeclared identifier 'Math'
        Math::Interpolator* my_interpolator = new Math::Interpolator(vec_a, vec_b, ROOT::Math::Interpolation::kLINEAR);
        ^
././interpolate.C:10:44: error: use of undeclared identifier 'Math'
        Math::Interpolator* my_interpolator = new Math::Interpolator(vec_a, vec_b, ROOT::Math::Interpolation::kLINEAR);
                                                  ^
Error in <ACLiC>: Dictionary generation failed!

My understanding was that Math::Interpolator is defined in “Math/Interpolator.h”, which I include. But apparently, I miss something here …

BTW: Is there a general rule to find out which headers are required in ROOT?


ROOT Version: 5.34 and 6.16
Platform: GNU/Linux


ROOT::Math::Interpolator