The error undefined reference to main means that at linking time, there was no main()
function.
Looking at the example code, there is a comment that says:
Compile with -DTEST_INTEGRATOR to generate this little test
program.
Usage: ./integrator <dim> <tol> <integrand> <maxeval>
where = # dimensions, = relative tolerance,
is either 0/1/2 for the three test integrands (see below),
and is the maximum # function evaluations (0 for none).
Looking at the code, the main function is excluded from the build unless this symbol is defined.
So, add -DTEST_INTEGRATOR
to your command line for compiling. You'll probably also want a -o integrator
to make the output called integrator
instead of a.out
g++ -DTEST_INTEGRATOR -Wall `root-config --cflags --ldflags --libs` StevenJohnsonDoubleIntegration.cpp -o integrator