Compiler error related to c++17 string_view with gcc9.1

HI everyone!
When trying to compile my c++17 project with ROOT, I get this:

cd /home/cburgard/Physics/hww/HWWAnalysisCode/build/CAFCore/QFramework && /usr/bin/c++ -DQFramework_EXPORTS -I/home/cburgard/Physics/hww/HWWAnalysisCode -I/home/cburgard/Physics/hww/HWWAnalysisCode/CAFCore/QFramework -I/home/cburgard/Physics/hww/HWWAnalysisCode/CAFCore/SFramework -I/home/cburgard/Physics/root/build/include -I/usr/include/libxml2 -I/home/cburgard/Physics/hww/HWWAnalysisCode/build/CAFCore/QFramework -g -std=c++14 -pipe -fsigned-char -pthread -std=c++14 -pipe -fsigned-char -pthread -std=c++17 -g -std=c++14 -pipe -fsigned-char -pthread -fPIC -std=c++17 -o CMakeFiles/QFramework.dir/Root/TQABCDCalculator.cxx.o -c /home/cburgard/Physics/hww/HWWAnalysisCode/CAFCore/QFramework/Root/TQABCDCalculator.cxx In file included from /home/cburgard/Physics/root/build/include/TString.h:28, from /home/cburgard/Physics/hww/HWWAnalysisCode/CAFCore/QFramework/QFramework/TQNFBase.h:5, from /home/cburgard/Physics/hww/HWWAnalysisCode/CAFCore/QFramework/QFramework/TQABCDCalculator.h:5, from /home/cburgard/Physics/hww/HWWAnalysisCode/CAFCore/QFramework/Root/TQABCDCalculator.cxx:1: /home/cburgard/Physics/root/build/include/ROOT/RStringView.hxx:32:10: error: conflicting declaration of template ‘template using basic_string_view = std::experimental::fundamentals_v1::basic_string_view<_CharT, _Traits>’ 32 | using basic_string_view = ::std::experimental::basic_string_view<_CharT,_Traits>; | ^~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/9.1.0/bits/basic_string.h:48, from /usr/include/c++/9.1.0/string:55, from /home/cburgard/Physics/root/build/include/TSchemaHelper.h:17, from /home/cburgard/Physics/root/build/include/TGenericClassInfo.h:16, from /home/cburgard/Physics/root/build/include/Rtypes.h:193, from /home/cburgard/Physics/root/build/include/TMathBase.h:29, from /home/cburgard/Physics/root/build/include/TString.h:26, from /home/cburgard/Physics/hww/HWWAnalysisCode/CAFCore/QFramework/QFramework/TQNFBase.h:5, from /home/cburgard/Physics/hww/HWWAnalysisCode/CAFCore/QFramework/QFramework/TQABCDCalculator.h:5, from /home/cburgard/Physics/hww/HWWAnalysisCode/CAFCore/QFramework/Root/TQABCDCalculator.cxx:1: /usr/include/c++/9.1.0/string_view:90:11: note: previous declaration ‘template class std::basic_string_view’ 90 | class basic_string_view

This does not happen if I don’t include c++17. Is this a known bug, and is there anything I can do about this?


ROOT Version: e21189cc32893288986b7cf4f499afe0a0515126
Platform: Archlinux
Compiler: gcc 9.1


Hi,
you should be able to find a few more posts on the forum about this.
This happens if you reconfigure an existing build directory with a different C++ standard.
Start from an empty build directory (and stick to one C++ standard) and things should work fine.

Cheers,
Enrico

You also must compile ROOT with the same standard that you want to use for your project.

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