Solution for RStringView.hxx:32:37: error

usr/local/include/ROOT/RStringView.hxx:32:37: error: ‘experimental’ in namespace ‘std’ does not name a type
32 | using basic_string_view = ::std::experimental::basic_string_view<_CharT,_Traits>;
| ^~~~~~~~~~~~
In file included from /usr/local/include/TString.h:29,
from /usr/local/include/TNamed.h:26,
from /usr/local/include/TDirectory.h:24,
from /usr/local/include/TROOT.h:28,
from /home/soufiyan/Gate/Gate-9.0/source/arf/include/GateARFDataToRoot.hh:15,
from /home/soufiyan/Gate/Gate-9.0/source/arf/src/GateARFDataToRoot.cc:13:
/usr/local/include/ROOT/RStringView.hxx:32:37: error: ‘experimental’ in namespace ‘std’ does not name a type
32 | using basic_string_view = ::std::experimental::basic_string_view<_CharT,_Traits>;
| ^~~~~~~~~~~~
/usr/local/include/ROOT/RStringView.hxx:35:12: error: ‘basic_string_view’ does not name a type
35 | typedef basic_string_view string_view;
| ^~~~~~~~~~~~~~~~~
/usr/local/include/ROOT/RStringView.hxx:35:12: error: ‘basic_string_view’ does not name a type
35 | typedef basic_string_view string_view;
| ^~~~~~~~~~~~~~~~~
/usr/local/include/ROOT/RStringView.hxx:36:12: error: ‘basic_string_view’ does not name a type
36 | typedef basic_string_view<char16_t> u16string_view;
| ^~~~~~~~~~~~~~~~~
/usr/local/include/ROOT/RStringView.hxx:36:12: error: ‘basic_string_view’ does not name a type
36 | typedef basic_string_view<char16_t> u16string_view;
| ^~~~~~~~~~~~~~~~~
/usr/local/include/ROOT/RStringView.hxx:37:12: error: ‘basic_string_view’ does not name a type
37 | typedef basic_string_view<char32_t> u32string_view;
| ^~~~~~~~~~~~~~~~~
/usr/local/include/ROOT/RStringView.hxx:38:12: error: ‘basic_string_view’ does not name a type
38 | typedef basic_string_view<wchar_t> wstring_view;
| ^~~~~~~~~~~~~~~~~
/usr/local/include/ROOT/RStringView.hxx:37:12: error: ‘basic_string_view’ does not name a type
37 | typedef basic_string_view<char32_t> u32string_view;
| ^~~~~~~~~~~~~~~~~
/usr/local/include/ROOT/RStringView.hxx:48:28: error: ‘string_view’ is not a member of ‘std’
48 | inline double stod(std::string_view str, size_t *pos)
| ^~~~~~~~~~~
/usr/local/include/ROOT/RStringView.hxx:48:28: note: ‘std::string_view’ is only available from C++17 onwards
/usr/local/include/ROOT/RStringView.hxx:48:52: error: expected primary-expression before ‘*’ token
48 | inline double stod(std::string_view str, size_t *pos)
| ^
/usr/local/include/ROOT/RStringView.hxx:48:53: error: ‘pos’ was not declared in this scope; did you mean ‘pow’?
48 | inline double stod(std::string_view str, size_t *pos)
| ^~~
| pow
/usr/local/include/ROOT/RStringView.hxx:48:56: error: expression list treated as compound expression in initializer [-fpermissive]
48 | inline double stod(std::string_view str, size_t *pos)
| ^
/usr/local/include/ROOT/RStringView.hxx:65:56: error: ‘std::string_view’ has not been declared
65 | inline std::string &operator+=(std::string &left, std::string_view right)
| ^~~~~~~~~~~
/usr/local/include/ROOT/RStringView.hxx: In function ‘std::string& std::__ROOT::operator+=(std::string&, int)’:
/usr/local/include/ROOT/RStringView.hxx:67:29: error: request for member ‘data’ in ‘right’, which is of non-class type ‘int’
67 | return left.append(right.data(), right.size());
| ^~~~
/usr/local/include/ROOT/RStringView.hxx:67:43: error: request for member ‘size’ in ‘right’, which is of non-class type ‘int’
67 | return left.append(right.data(), right.size());
| ^~~~
/usr/local/include/ROOT/RStringView.hxx: At global scope:
/usr/local/include/ROOT/RStringView.hxx:84:17: error: expected type-specifier
84 | operator std::string_view() const { return std::string_view(fData,fLength); }
| ^~~
/usr/local/include/ROOT/RStringView.hxx:38:12: error: ‘basic_string_view’ does not name a type

Hi,
this is a C++ standard mismatch, e.g. ROOT was compiled with a given C++ standard and your application with another.

How did you install ROOT? You can check what C++ standard it supports by running root-config --features.

Cheers,
Enrico

Hi i got this with this command

cxx14 asimage builtin_afterimage builtin_clang builtin_cling builtin_freetype builtin_llvm builtin_lz4 builtin_lzma builtin_nlohmannjson builtin_openssl builtin_openui5 builtin_pcre builtin_tbb builtin_vdt builtin_xrootd builtin_xxhash builtin_zlib builtin_zstd clad dataframe exceptions gdml http imt mlp roofit webgui root7 runtime_cxxmodules shared ssl tmva spectrum vdt x11 xrootd

Ok, so your ROOT is compiled for C++14. Is your application/project being compiled with C++14 too?

C++ compiler (new enough to compile code with the C++11 standard

Can you check the exact compilation command that breaks the compilation of your project? E.g. with make VERBOSE=1 or similar. The compilation command will contain -std=C++XX where XX is the standard, and if it’s not 14, there is a mismatch between what ROOT was compiled with and what the project is being compiled with.

Hi sir you are right is c++11 how can i change c++14 with c++11 to compile my project

If you are using cmake, you can use cmake -DCMAKE_CXX_STANDARD=14 .

1 Like

thanks you sir it’s done .

1 Like

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