# Problem Installing Garfield

**URL:** <https://root-forum.cern.ch/t/problem-installing-garfield/50199>\
**Category:** Garfield++\
**Created:** [May 31, 2022, 5:08pm UTC](https://root-forum.cern.ch/t/problem-installing-garfield/50199 "2022-05-31T17:08:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Johann\_Mazzacaro](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/johann_mazzacaro/32/29046_2.png) [@Johann\_Mazzacaro](https://root-forum.cern.ch/u/Johann_Mazzacaro)\
**Post date:** [May 31, 2022, 5:08pm UTC](https://root-forum.cern.ch/t/problem-installing-garfield/50199/1 "2022-05-31T17:08:23Z")

</div>

Im getting the following error when installing Garfield, im kind of a newbie when using Linux and I have tryed fixing this many times. Im trying to install Garfield on my Ubuntu22.04 LTS. I have installed the precompiled version of ROOT6.26/02 and Geant4 10.7.3, which I compiled myself. Both are working fine, but when I try to Make garfield, the following errors happen: Can someone maybe help me?

[90%] Building CXX object Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/exampleGarfield.cc.o  
In file included from /home/lsd/root/include/RtypesCore.h:23,  
from /home/lsd/root/include/Rtypes.h:23,  
from /home/lsd/root/include/TObject.h:17,  
from /home/lsd/root/include/TNamed.h:25,  
from /home/lsd/root/include/TRandom.h:25,  
from /home/lsd/root/include/TRandom3.h:25,  
from /home/lsd/garfieldpp/Include/Garfield/RandomEngineRoot.hh:4,  
from /home/lsd/garfieldpp/Include/Garfield/Random.hh:6,  
from /home/lsd/garfieldpp/Examples/Geant4GarfieldInterface/exampleGarfield.cc:46:  
/home/lsd/root/include/ROOT/RConfig.hxx:48:4: error: #error “ROOT requires support for C++14 or higher.”  
48 | # error “ROOT requires support for C++14 or higher.”  
| ^ ~~~~  
/home/lsd/root/include/ROOT/RConfig.hxx:50:5: error: #error “Pass `-std=c++14` as compiler argument.”  
50 | # error “Pass `-std=c++14` as compiler argument.”  
| ^ ~~~~  
In file included from /home/lsd/root/include/TString.h:29,  
from /home/lsd/root/include/TNamed.h:26,  
from /home/lsd/root/include/TRandom.h:25,  
from /home/lsd/root/include/TRandom3.h:25,  
from /home/lsd/garfieldpp/Include/Garfield/RandomEngineRoot.hh:4,  
from /home/lsd/garfieldpp/Include/Garfield/Random.hh:6,  
from /home/lsd/garfieldpp/Examples/Geant4GarfieldInterface/exampleGarfield.cc:46:  
/home/lsd/root/include/ROOT/RStringView.hxx:90:17: error: expected type-specifier  
90 | operator std::string\_view() const { return std::string\_view(fData,fLength); }  
| ^~~  
In file included from /home/lsd/root/include/TString.h:30,  
from /home/lsd/root/include/TNamed.h:26,  
from /home/lsd/root/include/TRandom.h:25,  
from /home/lsd/root/include/TRandom3.h:25,  
from /home/lsd/garfieldpp/Include/Garfield/RandomEngineRoot.hh:4,  
from /home/lsd/garfieldpp/Include/Garfield/Random.hh:6,  
from /home/lsd/garfieldpp/Examples/Geant4GarfieldInterface/exampleGarfield.cc:46:  
/home/lsd/root/include/ROOT/TypeTraits.hxx:49:54: error: ‘decay\_t’ is not a member of ‘std’; did you mean ‘decay’?  
49 | using arg\_types = ROOT::TypeTraits::TypeList\<std::decay\_t…\>;  
| ^ ~~~~~~  
| decay  
/home/lsd/root/include/ROOT/TypeTraits.hxx:49:54: error: ‘decay\_t’ is not a member of ‘std’; did you mean ‘decay’?  
49 | using arg\_types = ROOT::TypeTraits::TypeList\<std::decay\_t…\>;  
| ^ ~~~~~~  
| decay  
/home/lsd/root/include/ROOT/TypeTraits.hxx:49:66: error: template argument 1 is invalid  
49 | using arg\_types = ROOT::TypeTraits::TypeList\<std::decay\_t…\>;  
| ^  
/home/lsd/root/include/ROOT/TypeTraits.hxx:57:54: error: ‘decay\_t’ is not a member of ‘std’; did you mean ‘decay’?  
57 | using arg\_types = ROOT::TypeTraits::TypeList\<std::decay\_t…\>;  
| ^ ~~~~~~  
| decay  
/home/lsd/root/include/ROOT/TypeTraits.hxx:57:54: error: ‘decay\_t’ is not a member of ‘std’; did you mean ‘decay’?  
57 | using arg\_types = ROOT::TypeTraits::TypeList\<std::decay\_t…\>;  
| ^ ~~~~~~  
| decay  
/home/lsd/root/include/ROOT/TypeTraits.hxx:57:66: error: template argument 1 is invalid  
57 | using arg\_types = ROOT::TypeTraits::TypeList\<std::decay\_t…\>;  
| ^  
/home/lsd/root/include/ROOT/TypeTraits.hxx:65:54: error: ‘decay\_t’ is not a member of ‘std’; did you mean ‘decay’?  
65 | using arg\_types = ROOT::TypeTraits::TypeList\<std::decay\_t…\>;  
| ^ ~~~~~~  
| decay  
/home/lsd/root/include/ROOT/TypeTraits.hxx:65:54: error: ‘decay\_t’ is not a member of ‘std’; did you mean ‘decay’?  
65 | using arg\_types = ROOT::TypeTraits::TypeList\<std::decay\_t…\>;  
| ^ ~~~~~~  
| decay  
/home/lsd/root/include/ROOT/TypeTraits.hxx:65:66: error: template argument 1 is invalid  
65 | using arg\_types = ROOT::TypeTraits::TypeList\<std::decay\_t…\>;  
| ^  
/home/lsd/root/include/ROOT/TypeTraits.hxx:73:54: error: ‘decay\_t’ is not a member of ‘std’; did you mean ‘decay’?  
73 | using arg\_types = ROOT::TypeTraits::TypeList\<std::decay\_t…\>;  
| ^ ~~~~~~  
| decay  
/home/lsd/root/include/ROOT/TypeTraits.hxx:73:54: error: ‘decay\_t’ is not a member of ‘std’; did you mean ‘decay’?  
73 | using arg\_types = ROOT::TypeTraits::TypeList\<std::decay\_t…\>;  
| ^ ~~~~~~  
| decay  
/home/lsd/root/include/ROOT/TypeTraits.hxx:73:66: error: template argument 1 is invalid  
73 | using arg\_types = ROOT::TypeTraits::TypeList\<std::decay\_t…\>;  
| ^  
In file included from /home/lsd/root/include/TNamed.h:26,  
from /home/lsd/root/include/TRandom.h:25,  
from /home/lsd/root/include/TRandom3.h:25,  
from /home/lsd/garfieldpp/Include/Garfield/RandomEngineRoot.hh:4,  
from /home/lsd/garfieldpp/Include/Garfield/Random.hh:6,  
from /home/lsd/garfieldpp/Examples/Geant4GarfieldInterface/exampleGarfield.cc:46:  
/home/lsd/root/include/TString.h:115:13: error: expected type-specifier  
115 | operator std::string\_view() const { return std::string\_view(Data(),fExtent); }  
| ^~~  
/home/lsd/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/lsd/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/lsd/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/lsd/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/lsd/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/lsd/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/lsd/root/include/TNamed.h:26,  
from /home/lsd/root/include/TRandom.h:25,  
from /home/lsd/root/include/TRandom3.h:25,  
from /home/lsd/garfieldpp/Include/Garfield/RandomEngineRoot.hh:4,  
from /home/lsd/garfieldpp/Include/Garfield/Random.hh:6,  
from /home/lsd/garfieldpp/Examples/Geant4GarfieldInterface/exampleGarfield.cc:46:  
/home/lsd/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/lsd/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/lsd/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/lsd/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/lsd/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/lsd/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/lsd/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/lsd/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:76: Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/exampleGarfield.cc.o] Erro 1  
make[1]: \*\*\* [CMakeFiles/Makefile2:1259: Examples/Geant4GarfieldInterface/CMakeFiles/exampleGeant4Interface.dir/all] Erro 2  
make: \*\*\* [Makefile:136: all] Erro 2

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [May 31, 2022, 7:11pm UTC](https://root-forum.cern.ch/t/problem-installing-garfield/50199/2 "2022-05-31T19:11:31Z")

</div>

Hi,  
you need to make sure that ROOT, Geant4 and Garfield++ are compiled using the same C++ standard:

> [@Problem in installation](https://root-forum.cern.ch/t/problem-in-installation/45918/12):
>
> You can build a c++14 aware Geant4 using: cmake -DGEANT4\_BUILD\_CXXSTD=14 ... If you want to have everything using c++17, you need to build ROOT using “cmake -DCMAKE\_CXX\_STANDARD=17” and Geant4 using “cmake -DGEANT4\_BUILD\_CXXSTD=17” Note that, afterward, in any case, you also need to build Garfield++ with the same C++ standard (I guess @hschindl can tell you how).

---

<div class="post-metadata">

**Author:** ![Johann\_Mazzacaro](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/johann_mazzacaro/32/29046_2.png) [@Johann\_Mazzacaro](https://root-forum.cern.ch/u/Johann_Mazzacaro)\
**Post date:** [June 1, 2022, 2:02pm UTC](https://root-forum.cern.ch/t/problem-installing-garfield/50199/3 "2022-06-01T14:02:47Z")

</div>

Installation was fixed, thank you very much for your reply!

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [June 15, 2022, 2:03pm UTC](https://root-forum.cern.ch/t/problem-installing-garfield/50199/4 "2022-06-15T14:03:01Z")

</div>

Closed on June 15, 2022, 2:03pm UTC

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