I am trying to run a macro which compiles some other macros in ROOT (Version 5.34), and some of the header files need C++ 11. I run a script which looks like this:
As you can see, we have tried various ways to get the compiler to recognize the “-std=c++11” flag. But when I run it, I get an error which looks like this:
/usr/include/c++/4.9/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options. #error This file requires compiler and library support for the
^
Error: external preprocessing failed. :0:
!!!Removing /user/e15091/analysis_master/src/sweeper_cc_ACLiC_dict.cxx /user/e15091/analysis_master/src/sweeper_cc_ACLiC_dict.h !!!
Error: /mnt/misc/sw/x86_64/Debian/8/root/gnu/5.34.32/bin/rootcint: error loading headers…
Error in : Dictionary generation failed!
Info in : Invoking compiler to check macro’s validity
Info in : The compiler has not found any problem with your macro.
Probably your macro uses something rootcint can’t parse.
Check http://root.cern.ch/viewvc/branches/v5-34-00-patches/cint/doc/limitati.txt for Cint’s limitations.
So despite all of our attempts, it seems like the compiler still doesn’t recognize the C++ 11 flag, and the compilation is failing.
Is there something I can do to get rid of this error?
You will probably have to move to ROOT 6 if you need C++11. The old CINT interpreter lacks support for a variety of C++ features and that was the main reason it was replaced with cling in ROOT 6.
Do you have the same problem if you compile from the command line? Something needs to be pointing to ROOT5 still for you to end up with a binary that requires libCint rather than libCling.
cling::DynamicLibraryManager::loadLibrary(): libCint.so.5: cannot open shared object file: No such file or directory
comes up whenever I open ROOT. So it’s not caused by me compiling/running my program. I think there is a path somewhere which is still pointing to something related to ROOT 5 instead of ROOT 6 for some reason.
as Guilherme says, you need to use ROOT6 to take advantage of new C++ stadards.
The error here points indeed to a faulty installation of ROOT. I would remove entirely ROOT5 from the system and start from scratch with ROOT6.
I found a path which was accidentally left pointing to a ROOT logon macro pointing to the ROOT 5 installation. Once I fixed that, the problems went away. My original code compiles and runs properly in ROOT 6.