How can CompileMacro be directed to use C++11?

Essentially, how can CompileMacro be directed to apply -std=c++11 or equivalent when compiling?

TSystem::GetMakeSharedLib + TSystem::SetMakeSharedLib
TSystem::GetMakeExe + TSystem::SetMakeExe

Thanks for the answer.
I can modify the command that way, but still have warnings mentioning c++11.

Basically, I set the command to:

cd $BuildDir ; g++  -c  -pipe -m64 -W -Woverloaded-virtual -fPIC -DG__MAXSTRUCT=36000 -DG__MAXTYPEDEF=36000 -DG__LONGLINE=4096 -pthread -std=c++11 $IncludePath $SourceFiles; g++ $ObjectFiles -m64 -O2  -Wl,--no-undefined -Wl,--as-needed -o $ExeName $LinkedLibs -lm -ldl  -pthread  -std=c++11 -rdynamic

(Just added the -std=c++11 in both g++ commands)

And the warnings still are:

warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11 [enabled by default]
warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]

Would you know if I’m setting the command wrongly ?


The building commands used by ACLiC when you “+” code depend on the compiler options used when compiling ROOT itself. If ROOT was not built with --enable-cxx11, you need to add -std=c++11 to the command strings as you have done. However this is not enough, as you still get warnings.

Try also adding “-Wnoc++11-extensions” to the commands, like I did here: [C++11 in ROOT

The more durable method is to recompile ROOT itself with --enable-cxx11, since then the correct flags will be in the build commands automatically.



this works fine now. I no longer have the warnings and errors related to c++11. However, my main code refuses now to compile

Info in <ACLiC>: The compiler has not found any problem with your macro. Probably your macro uses something rootcint can't parse.

I also tried some prints with gDebug=7 but I see no problem mentioned. I’ll try to find a version of the package I want to plug which doesn’t require c++11.


I also have the same issue on old lab computer. Still don’t know how to solve it.