Compiling simple program/ Symbols not found

Dear all

I am attempting to compile a program with a Minuit2Minimizer using clang++ and root 5.34/32 on OSX 10.10.5.
A minimal example below:

#include <Minuit2/Minuit2Minimizer.h>

void comptest(){
    ROOT::Minuit2::Minuit2Minimizer*  a= new ROOT::Minuit2::Minuit2Minimizer(); 
}

int main(){
    comptest();
    return 0;
}

Trying to compile this program with:

clang++ -pthread -stdlib=libc++ -m64 -I/Users/knutdundasmora/ResearchSoftware/root53432/root/include -o comptest comptest.cxx -L/Users/knutdundasmora/ResearchSoftware/root53432/root/lib -lGui -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lpthread -Wl,-rpath,/Users/knutdundasmora/ResearchSoftware/root53432/root/lib -stdlib=libc++ -lm -ldl

will result in an error:

Undefined symbols for architecture x86_64:
  "ROOT::Minuit2::Minuit2Minimizer::Minuit2Minimizer(ROOT::Minuit2::EMinimizerType)", referenced from:
      comptest() in comptest-ae6f64.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Am able to run the program with root, both interactively as well as compiled.

The compilation flags etc. are the outputs of root-config --cflags and root-config --glibs.
I have attempted to see if Minuit2 exists for the correct architecture;
-I tried changing the stdlib=libc++ to libstdc++, and the xcode command line tools are installed.
-Minuit2 is installed (root-config --has-minuit2 = yes), and it seems to be the correct architecture as well:
-"file libMinuit2.so = libMinuit2.so: Mach-O 64-bit dynamically linked shared library x86_64)
Everything seems correct to me.

Any help would be greatly appreciated;
Knut

-lMinuit2

Doh! Thanks a lot.
Do you know if there is a way to add library names to root-config --glibs (for makefiles etc?)

Hope you catch the bird;
Knut

You should not modify the “root-config” script.
You’d better modify your “makefile” using something like:
ROOTLIBS="$(shell root-config --glibs)“
ROOTLIBS+=” -lMinuit2 -lWhatever -lExtra -lYou -lNeed"