【Linux operation 34】configure: error:A compiler with support for C++11 language features is required

1、SUSE升级gcc时出现异常

linux-1psk:/gcc/gcc-12.1.0/build # ../configure -enable-checking=release -enable-languages=c,c++ -disable-multilib
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /usr/bin/sed
checking for gawk... gawk
checking for libatomic support... yes
checking for libitm support... yes
checking for libsanitizer support... yes
checking for libvtv support... yes
checking for libphobos support... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for gcc option to accept ISO C99... -std=gnu99
checking for g++... no
checking for c++... no
checking for gpp... no
checking for aCC... no
checking for CC... no
checking for cxx... no
checking for cc++... no
checking for cl.exe... no
checking for FCC... no
checking for KCC... no
checking for RCC... no
checking for xlC_r... no
checking for xlC... no
checking whether we are using the GNU C++ compiler... no
checking whether g++ accepts -g... no
checking whether g++ accepts -static-libstdc++ -static-libgcc... no
checking for gnatbind... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking for gdc... no
checking whether the D compiler works... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking whether g++ supports C++11 features by default... no
checking whether g++ supports C++11 features with -std=gnu++11... no
checking whether g++ supports C++11 features with -std=gnu++0x... no
checking whether g++ supports C++11 features with -std=c++11... no
checking whether g++ supports C++11 features with +std=c++11... no
checking whether g++ supports C++11 features with -h std=c++11... no
checking whether g++ supports C++11 features with -std=c++0x... no
checking whether g++ supports C++11 features with +std=c++0x... no
checking whether g++ supports C++11 features with -h std=c++0x... no
configure: error: *** A compiler with support for C++11 language features is required.

2、解决办法

linux-1psk:/gcc/gcc-12.1.0/build # zypper install install gcc-c++ -y
Loading repository data...
Reading installed packages...
'install' not found in package names. Trying capabilities.
No provider of 'install' found.
'-y' not found in package names. Trying capabilities.
No provider of '-y' found.
Resolving package dependencies...

The following 3 NEW packages are going to be installed:
  gcc-c++ gcc48-c++ libstdc++48-devel

3 new packages to install.
Overall download size: 8.4 MiB. Already cached: 0 B. After the operation, additional 38.1 MiB will be used.
Continue? [y/n/...? shows all options] (y): y
Retrieving package libstdc++48-devel-4.8.5-31.20.1.x86_64                                                                                                                                (1/3),   2.8 MiB ( 23.6 MiB unpacked)Retrieving package gcc48-c++-4.8.5-31.20.1.x86_64                                                                                                                                        (2/3),   5.6 MiB ( 14.5 MiB unpacked)Retrieving package gcc-c++-4.8-6.189.x86_64                                                                                                                                              (3/3),   4.8 KiB (    0   B unpacked)
Checking for file conflicts: ...........................................................................................................................................................................................[done]
(1/3) Installing: libstdc++48-devel-4.8.5-31.20.1.x86_64 ...............................................................................................................................................................[done]
(2/3) Installing: gcc48-c++-4.8.5-31.20.1.x86_64 .......................................................................................................................................................................[done]
(3/3) Installing: gcc-c++-4.8-6.189.x86_64 .............................................................................................................................................................................[done]

猜你喜欢

转载自blog.csdn.net/qq_22938603/article/details/125440902