Error trying to use functions from Mathmore

I’m getting the following error when I try to run a root macro in bash terminal (root -l -b mymacro.C) or when a load the macro manually in root.:

IncrementalExecutor::executeFunction: symbol ‘_ZN4ROOT4Math6expintEd’ unresolved while linking [cling interface function]!
You are probably missing the definition of ROOT::Math::expint(double)
Maybe you need to load the corresponding shared library?

I’ve included the following headers:

#include "TMinuit.h"
#include "TMath.h"
#include "TFile.h"
#include "TH1F.h"
#include "TF1.h"
#include "TTree.h"
#include "TRandom.h"
#include "gsl/gsl_sf_expint.h"

The problem seems to be due to this custom function I’m defining before the void myfunc():

Double_t Energy_int(Double_t emin, Double_t emax, Double_t element, Double_t m_a){
	Double_t rvt;
	Double_t xmin = x_n(element, emin, m_a);
	Double_t xmax = x_n(element, emax, m_a);

	if(emin > emax){rvt = 0;}
	else{
	rvt = (TMath::Exp(-xmax)/xmax + ROOT::Math::expint(-xmax)) - (TMath::Exp(-xmin)/xmin + ROOT::Math::expint(-xmin));

	}
	return rvt;


}

I can use the exponential integral function if I prompt gSystem->Load(“libMathMore”) in root before loading the macro. When I do it, the macro doesn’t have any errors.

Is there any way I can run the macro directly from bash or compile it only once without the need to prompt gSystem->Load(“libMathMore”)?

Thank you in advance

_ROOT Version: 6.04/14
_Platform:linuxx8664gcc


After the #includes, add R__LOAD_LIBRARY(MathMore) - that should solve it!

Thank you!