Genreflex (6.08/02) failing to process valid C++11 code

I am trying to generate a dictionary for my project (after much help from users on this forum!) On a CERN machine where all the details are taken care of for me via CMake, this has been working for a while, but after some recent (probably buggy) additions on my part, the dictionary generation stalls. So, I’m trying to run the dictionary generation manually on my own machine to see more verbose results. However, I run in a more basic problem now, in that valid C++11 code is rejected:

> genreflex dict/EspressoDict.hh -s dict/EspressoDict.xml
In file included from input_line_9:9:
In file included from ./Espresso/GLMBuilder.hh:8:
In file included from ./Espresso/RooGLMFunction.hh:10:
In file included from ./Espresso/GLMCalibration.hh:20:
In file included from ./Espresso/GLMCalibrationFunction.hh:22:
In file included from ./Espresso/GLMModel.hh:16:
In file included from ./Espresso/TaggingResult.hh:16:
./Espresso/BDecayModel.hh:107:29: error: no member named 'make_unique' in namespace 'std'
      m_LifetimeDist = std::make_unique<typename std::decay<T>::type>(std::forward<T>(dist));
                       ~~~~~^
./Espresso/BDecayModel.hh:107:69: error: expected '(' for function-style cast or type construction
      m_LifetimeDist = std::make_unique<typename std::decay<T>::type>(std::forward<T>(dist));
                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
./Espresso/BDecayModel.hh:124:31: error: no member named 'make_unique' in namespace 'std'
      m_ResolutionDist = std::make_unique<typename std::decay<T>::type>(std::forward<T>(dist));
                         ~~~~~^
./Espresso/BDecayModel.hh:124:71: error: expected '(' for function-style cast or type construction
      m_ResolutionDist = std::make_unique<typename std::decay<T>::type>(std::forward<T>(dist));
                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
Error: rootcling: compilation failure (dict/EspressoDict_rflxd088b89dee_dictUmbrella.h)

Do I need to add compiler flags to my genreflex call? I didn’t find any such instructions in the documentations, and blindly trying the GCC/Clang compiler flags did not work.

Hi,

unfortunately make_unique is not c++11 but c++14 (http://en.cppreference.com/w/cpp/memory/unique_ptr/make_unique).
You can try to rebuild with -Dcxx14=ON if you need this nice functionality.

Cheers,
D

1 Like

Ah, thanks, I always forget that. How should this flag be added?

> genreflex -Dcxx14=ON dict/EspressoDict.hh -s dict/EspressoDict.xml
Error: No valid header was provided!

does not work; neither does adding the flag at the end.

Hi,

this error is prompted by the compiler backing up the root interpreter. There is consistency between the standard adopted by ROOT to build the framework and the standard used by its interpreter to interpret code. No flags to be passed explicitly here.

D

You mean I need to recompile ROOT with C++14?

Yes, I do if you need to use make_unique .

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.