Can't use THnSparse in compiled app

Hi all,
I am on Mavericks, and have read all the threads on compilation problems. But I can compile apps using root classes just fine (reading TTrees, filling TH1-3/TGraphs, drawing onto canvasses, writing postscript, etc). All that works just fine.
Then I tried replacing a TH3D with a THnSparseD and it won’t link. I boiled it down to a very simple test program which is in the attached tar.gz file. Simply instantiating a THnSparse object results in the link error shown below…
Any suggestions? thanks!

mac8_[~/fluct/events/sparsetest] make g++ -c -m64 -stdlib=libc++ -std=c++11 -g -O -I. -ITPC -I. -I/Users/wjllope/root_v5.34.13_build_64bit/include -I/Users/wjllope/rootdev/include -g -Wno-write-strings -m64 test.cxx -I. -I/Users/wjllope/root_v5.34.13_build_64bit/include -I/Users/wjllope/rootdev/include g++ -v test.o \ -Qunused-arguments -stdlib=libc++ -m64 -I. -I/Users/wjllope/root_v5.34.13_build_64bit/include -I/Users/wjllope/rootdev/include -L/Users/wjllope/root_v5.34.13_build_64bit/lib -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lpthread -Wl,-rpath,/Users/wjllope/root_v5.34.13_build_64bit/lib -lm -ldl -lGui -lHtml -lGuiHtml -o test Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn) Target: x86_64-apple-darwin13.2.0 Thread model: posix "/Applications/" -demangle -dynamic -arch x86_64 -macosx_version_min 10.9.0 -o test -L/Users/wjllope/root_v5.34.13_build_64bit/lib test.o -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lpthread -rpath /Users/wjllope/root_v5.34.13_build_64bit/lib -lm -ldl -lGui -lHtml -lGuiHtml -lc++ -lSystem /Applications/ Undefined symbols for architecture x86_64: "TObject::SavePrimitive(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*)", referenced from: vtable for THnSparseT<TArrayD> in test.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [test] Error 1
sparsetest.tar.gz (63.5 KB)


You are using libc++ and for that I’d recommend trying 5.34.18, .13 is likely just too old. Make sure your ROOT is also built with libc++!

Cheers, Axel

Thanks Axel - that did it. Cheers