I have installed gcc 9.3.0, it is theoretical support c++17…I am not sure whether the problem is form here.
I think posting a entire code may help to resolve this problem effectively, here is the code.
lyp@lyp-System-Product-Name:~/garfield++/garfieldpp-4.0/build$ make -j8
[ 1%] Built target magboltz
[ 66%] Built target Garfield
[ 69%] Built target generate
[ 69%] Built target printTable
[ 69%] Built target merge
[ 70%] Built target gem
[ 71%] Built target penning
[ 72%] Built target read
[ 73%] Built target mdt
[ 74%] Built target mdt_mt
[ 76%] Built target polar
[ 76%] Built target gallery
[ 77%] Built target strip
[ 78%] Built target dipole
[ 80%] Built target fieldlines
[ 80%] Built target integrate
[ 81%] Built target isochrons
[ 82%] Built target wedge
[ 83%] Built target savefield
[ 85%] Built target trim
[ 85%] Built target plotdedx
[ 86%] Built target edep
[ 88%] Built target rangeSi
[ 88%] Built target qdepSi
[ 89%] Built target plotfield
[ 90%] Built target fe55
[ 91%] Built target srim
[ 91%] Built target parallelPlates
[ 92%] Built target MWPCbyneBEM
[ 92%] Built target parallelPlatesWeightingField
[ 93%] Built target crossingWires
[ 93%] Built target BiconicalGemByneBEM
[ 94%] Built target RPCbyneBEM
[ 95%] Building CXX object Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/exampleGarfield.cc.o
[ 96%] Building CXX object Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/src/GarfieldG4FastSimulationModel.cc.o
[ 96%] Building CXX object Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/src/GarfieldMessenger.cc.o
[ 96%] Building CXX object Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/src/GarfieldPhysics.cc.o
[ 97%] Building CXX object Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/src/GarfieldPrimaryGeneratorAction.cc.o
[ 97%] Building CXX object Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/src/GarfieldPhysicsList.cc.o
[ 97%] Building CXX object Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/src/GarfieldRunAction.cc.o
[ 98%] Building CXX object Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/src/GarfieldSteppingAction.cc.o
/home/lyp/garfield++/garfieldpp-4.0/Examples/Geant4GarfieldInterface/src/GarfieldG4FastSimulationModel.cc:36:10: fatal error: G4GDMLParser.hh: 没有那个文件或目录
36 | #include “G4GDMLParser.hh”
| ^~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/build.make:102:Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/src/GarfieldG4FastSimulationModel.cc.o] 错误 1
make[2]: *** 正在等待未完成的任务…
In file included from /home/lyp/garfield++/root/include/TString.h:29,
from /home/lyp/garfield++/root/include/TNamed.h:26,
from /home/lyp/garfield++/root/include/TRandom.h:25,
from /home/lyp/garfield++/root/include/TRandom3.h:25,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/RandomEngineRoot.hh:4,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/Random.hh:6,
from /home/lyp/garfield++/garfieldpp-4.0/Examples/Geant4GarfieldInterface/exampleGarfield.cc:46:
/home/lyp/garfield++/root/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>;
| ^~~~~~~~~~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:35:12: error: ‘basic_string_view’ does not name a type
35 | typedef basic_string_view string_view;
| ^~~~~~~~~~~~~~~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:36:12: error: ‘basic_string_view’ does not name a type
36 | typedef basic_string_view<char16_t> u16string_view;
| ^~~~~~~~~~~~~~~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:37:12: error: ‘basic_string_view’ does not name a type
37 | typedef basic_string_view<char32_t> u32string_view;
| ^~~~~~~~~~~~~~~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:38:12: error: ‘basic_string_view’ does not name a type
38 | typedef basic_string_view<wchar_t> wstring_view;
| ^~~~~~~~~~~~~~~~~
/home/lyp/garfield++/root/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)
| ^~~~~~~~~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:48:28: note: ‘std::string_view’ is only available from C++17 onwards
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:48:52: error: expected primary-expression before ‘’ token
48 | inline double stod(std::string_view str, size_t pos)
| ^
/home/lyp/garfield++/root/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
/home/lyp/garfield++/root/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)
| ^
/home/lyp/garfield++/root/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)
| ^~~~~~~~~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx: In function ‘std::string& std::__ROOT::operator+=(std::string&, int)’:
/home/lyp/garfield++/root/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());
| ^~~~
/home/lyp/garfield++/root/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());
| ^~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx: At global scope:
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:84:17: error: expected type-specifier
84 | operator std::string_view() const { return std::string_view(fData,fLength); }
| ^~~
In file included from /home/lyp/garfield++/root/include/TNamed.h:26,
from /home/lyp/garfield++/root/include/TRandom.h:25,
from /home/lyp/garfield++/root/include/TRandom3.h:25,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/RandomEngineRoot.hh:4,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/Random.hh:6,
from /home/lyp/garfield++/garfieldpp-4.0/Examples/Geant4GarfieldInterface/exampleGarfield.cc:46:
/home/lyp/garfield++/root/include/TString.h:115:13: error: expected type-specifier
115 | operator std::string_view() const { return std::string_view(Data(),fExtent); }
| ^~~
/home/lyp/garfield++/root/include/TString.h:280:32: error: ‘string_view’ in namespace ‘std’ does not name a type
280 | explicit TString(const std::string_view &sub);
| ^~~~~~~~~~~
/home/lyp/garfield++/root/include/TString.h:280:27: note: ‘std::string_view’ is only available from C++17 onwards
280 | explicit TString(const std::string_view &sub);
| ^~~
/home/lyp/garfield++/root/include/TString.h:317:37: error: ‘string_view’ in namespace ‘std’ does not name a type
317 | TString &operator=(const std::string_view &s);
| ^~~~~~~~~~~
/home/lyp/garfield++/root/include/TString.h:317:32: note: ‘std::string_view’ is only available from C++17 onwards
317 | TString &operator=(const std::string_view &s);
| ^~~
/home/lyp/garfield++/root/include/TString.h:444:9: error: ‘string_view’ in namespace ‘std’ does not name a type
444 | std::string_view View() const { return std::string_view(GetPointer(),Length()); }
| ^~~~~~~~~~~
/home/lyp/garfield++/root/include/TString.h:444:4: note: ‘std::string_view’ is only available from C++17 onwards
444 | std::string_view View() const { return std::string_view(GetPointer(),Length()); }
| ^~~
In file included from /home/lyp/garfield++/root/include/TNamed.h:26,
from /home/lyp/garfield++/root/include/TRandom.h:25,
from /home/lyp/garfield++/root/include/TRandom3.h:25,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/RandomEngineRoot.hh:4,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/Random.hh:6,
from /home/lyp/garfield++/garfieldpp-4.0/Examples/Geant4GarfieldInterface/exampleGarfield.cc:46:
/home/lyp/garfield++/root/include/TString.h:839:53: error: ‘string_view’ in namespace ‘std’ does not name a type
839 | inline Bool_t operator==(const char *s1, const std::string_view &s2)
| ^~~~~~~~~~~
/home/lyp/garfield++/root/include/TString.h:839:48: note: ‘std::string_view’ is only available from C++17 onwards
839 | inline Bool_t operator==(const char s1, const std::string_view &s2)
| ^~~
/home/lyp/garfield++/root/include/TString.h:839:15: error: ‘Bool_t operator==(const char, const int&)’ must have an argument of class or enumerated type
839 | inline Bool_t operator==(const char *s1, const std::string_view &s2)
| ^~~~~~~~
/home/lyp/garfield++/root/include/TString.h:844:37: error: ‘string_view’ in namespace ‘std’ does not name a type
844 | inline Bool_t operator==(const std::string_view &s1, const char *s2)
| ^~~~~~~~~~~
/home/lyp/garfield++/root/include/TString.h:844:32: note: ‘std::string_view’ is only available from C++17 onwards
844 | inline Bool_t operator==(const std::string_view &s1, const char s2)
| ^~~
/home/lyp/garfield++/root/include/TString.h:844:15: error: ‘Bool_t operator==(const int&, const char)’ must have an argument of class or enumerated type
844 | inline Bool_t operator==(const std::string_view &s1, const char *s2)
| ^~~~~~~~
/home/lyp/garfield++/root/include/TString.h:857:37: error: ‘string_view’ in namespace ‘std’ does not name a type
857 | std::string printValue(const std::string_view val);
| ^~~~~~~~~~~
/home/lyp/garfield++/root/include/TString.h:857:32: note: ‘std::string_view’ is only available from C++17 onwards
857 | std::string printValue(const std::string_view val);
| ^~~
make[2]: *** [Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/build.make:63:Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/exampleGarfield.cc.o] 错误 1
In file included from /home/lyp/garfield++/root/include/TString.h:29,
from /home/lyp/garfield++/root/include/TCollection.h:29,
from /home/lyp/garfield++/root/include/TSeqCollection.h:25,
from /home/lyp/garfield++/root/include/TList.h:25,
from /home/lyp/garfield++/root/include/TQObject.h:40,
from /home/lyp/garfield++/root/include/TVirtualPad.h:30,
from /home/lyp/garfield++/root/include/TPad.h:15,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/ViewBase.hh:8,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/ViewDrift.hh:12,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/AvalancheMC.hh:10,
from /home/lyp/garfield++/garfieldpp-4.0/Examples/Geant4GarfieldInterface/src/GarfieldPhysics.cc:31:
/home/lyp/garfield++/root/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>;
| ^~~~~~~~~~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:35:12: error: ‘basic_string_view’ does not name a type
35 | typedef basic_string_view string_view;
| ^~~~~~~~~~~~~~~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:36:12: error: ‘basic_string_view’ does not name a type
36 | typedef basic_string_view<char16_t> u16string_view;
| ^~~~~~~~~~~~~~~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:37:12: error: ‘basic_string_view’ does not name a type
37 | typedef basic_string_view<char32_t> u32string_view;
| ^~~~~~~~~~~~~~~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:38:12: error: ‘basic_string_view’ does not name a type
38 | typedef basic_string_view<wchar_t> wstring_view;
| ^~~~~~~~~~~~~~~~~
/home/lyp/garfield++/root/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)
| ^~~~~~~~~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:48:28: note: ‘std::string_view’ is only available from C++17 onwards
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:48:52: error: expected primary-expression before ‘’ token
48 | inline double stod(std::string_view str, size_t pos)
| ^
/home/lyp/garfield++/root/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
/home/lyp/garfield++/root/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)
| ^
/home/lyp/garfield++/root/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)
| ^~~~~~~~~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx: In function ‘std::string& std::__ROOT::operator+=(std::string&, int)’:
/home/lyp/garfield++/root/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());
| ^~~~
/home/lyp/garfield++/root/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());
| ^~~~
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx: At global scope:
/home/lyp/garfield++/root/include/ROOT/RStringView.hxx:84:17: error: expected type-specifier
84 | operator std::string_view() const { return std::string_view(fData,fLength); }
| ^~~
In file included from /home/lyp/garfield++/root/include/TCollection.h:29,
from /home/lyp/garfield++/root/include/TSeqCollection.h:25,
from /home/lyp/garfield++/root/include/TList.h:25,
from /home/lyp/garfield++/root/include/TQObject.h:40,
from /home/lyp/garfield++/root/include/TVirtualPad.h:30,
from /home/lyp/garfield++/root/include/TPad.h:15,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/ViewBase.hh:8,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/ViewDrift.hh:12,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/AvalancheMC.hh:10,
from /home/lyp/garfield++/garfieldpp-4.0/Examples/Geant4GarfieldInterface/src/GarfieldPhysics.cc:31:
/home/lyp/garfield++/root/include/TString.h:115:13: error: expected type-specifier
115 | operator std::string_view() const { return std::string_view(Data(),fExtent); }
| ^~~
/home/lyp/garfield++/root/include/TString.h:280:32: error: ‘string_view’ in namespace ‘std’ does not name a type
280 | explicit TString(const std::string_view &sub);
| ^~~~~~~~~~~
/home/lyp/garfield++/root/include/TString.h:280:27: note: ‘std::string_view’ is only available from C++17 onwards
280 | explicit TString(const std::string_view &sub);
| ^~~
/home/lyp/garfield++/root/include/TString.h:317:37: error: ‘string_view’ in namespace ‘std’ does not name a type
317 | TString &operator=(const std::string_view &s);
| ^~~~~~~~~~~
/home/lyp/garfield++/root/include/TString.h:317:32: note: ‘std::string_view’ is only available from C++17 onwards
317 | TString &operator=(const std::string_view &s);
| ^~~
/home/lyp/garfield++/root/include/TString.h:444:9: error: ‘string_view’ in namespace ‘std’ does not name a type
444 | std::string_view View() const { return std::string_view(GetPointer(),Length()); }
| ^~~~~~~~~~~
/home/lyp/garfield++/root/include/TString.h:444:4: note: ‘std::string_view’ is only available from C++17 onwards
444 | std::string_view View() const { return std::string_view(GetPointer(),Length()); }
| ^~~
In file included from /home/lyp/garfield++/root/include/TCollection.h:29,
from /home/lyp/garfield++/root/include/TSeqCollection.h:25,
from /home/lyp/garfield++/root/include/TList.h:25,
from /home/lyp/garfield++/root/include/TQObject.h:40,
from /home/lyp/garfield++/root/include/TVirtualPad.h:30,
from /home/lyp/garfield++/root/include/TPad.h:15,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/ViewBase.hh:8,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/ViewDrift.hh:12,
from /home/lyp/garfield++/garfieldpp-4.0/Include/Garfield/AvalancheMC.hh:10,
from /home/lyp/garfield++/garfieldpp-4.0/Examples/Geant4GarfieldInterface/src/GarfieldPhysics.cc:31:
/home/lyp/garfield++/root/include/TString.h:839:53: error: ‘string_view’ in namespace ‘std’ does not name a type
839 | inline Bool_t operator==(const char *s1, const std::string_view &s2)
| ^~~~~~~~~~~
/home/lyp/garfield++/root/include/TString.h:839:48: note: ‘std::string_view’ is only available from C++17 onwards
839 | inline Bool_t operator==(const char s1, const std::string_view &s2)
| ^~~
/home/lyp/garfield++/root/include/TString.h:839:15: error: ‘Bool_t operator==(const char, const int&)’ must have an argument of class or enumerated type
839 | inline Bool_t operator==(const char *s1, const std::string_view &s2)
| ^~~~~~~~
/home/lyp/garfield++/root/include/TString.h:844:37: error: ‘string_view’ in namespace ‘std’ does not name a type
844 | inline Bool_t operator==(const std::string_view &s1, const char *s2)
| ^~~~~~~~~~~
/home/lyp/garfield++/root/include/TString.h:844:32: note: ‘std::string_view’ is only available from C++17 onwards
844 | inline Bool_t operator==(const std::string_view &s1, const char s2)
| ^~~
/home/lyp/garfield++/root/include/TString.h:844:15: error: ‘Bool_t operator==(const int&, const char)’ must have an argument of class or enumerated type
844 | inline Bool_t operator==(const std::string_view &s1, const char *s2)
| ^~~~~~~~
/home/lyp/garfield++/root/include/TString.h:857:37: error: ‘string_view’ in namespace ‘std’ does not name a type
857 | std::string printValue(const std::string_view val);
| ^~~~~~~~~~~
/home/lyp/garfield++/root/include/TString.h:857:32: note: ‘std::string_view’ is only available from C++17 onwards
857 | std::string printValue(const std::string_view val);
| ^~~
make[2]: *** [Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/build.make:128:Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/src/GarfieldPhysics.cc.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:1174:Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/all] 错误 2
make: *** [Makefile:130:all] 错误 2