Error using mex
cc1plus: error: unrecognized command line option “-std=c++11”
1, download the source code
is here. To be on the safe side, 4.8.5 is selected. If you need another version, just change the version number
$wget HTTP:// ftp://ftp.gnu.org/gnu/gcc/gcc-4.8.5/gcc-4.8.5.tar.gz
2. Download dependency package & pre-installed
compiling and installing GCC depends on the MPC, MPFR, GMP package. Fortunately, GCC source script can easily download the dependency package.
$tar ZXF gcc-4.8.5.tar. Gz
$CD GCC – 4.8.5
$ ./contrib/download_prerequisites
You can see in this script that the version Numbers of the dependent packages are MPC-0.8.1, MPFR-2.4.2, gMP-4.3.2, in that order.
3, $yum -y install glibc-devel. I686 –setopt=protected_multilib=false
4. Compile and install
$ cd .. // The main reason for doing this is to create the build folder outside of the source code
$mkdir GCC – build – 4.8.5
$mkdir /usr/local/gcc-4.8.5 // include file.
$mkdir/usr/local/GCC// placed bin +.lib file
$CD GCC – build – 4.8.5
$ ../gC-4.8.5 /configure –prefix=/usr/local/ gC-4.8.5 –exec-prefix=/usr/local/ GCC –enable-languages= C, C ++ // To save time, only C and C ++ are compiled here
$ make & & make install
in order to avoid multiple versions of GCC in the system after installation, the directory to compile and install is directly specified under /usr/local/4.8.5 and /usr/local/gcc. If no -prefix is specified, it will be installed under /usr/local by default.
to wait
make after a long wait, done
5, environment variable configuration
rename GCC /g++ and keep the old version
$mv /usr/bin/ GCC /usr/bin/ GCC -4.4.7
$mv /usr/bin/g++ /usr/bin/g++-4.4.7
$export PATH=/usr/local/ GCC /bin:$PATH # use the latest GCC /g++;
confirm version number
$ g++ –version
$ gcc –version
$ which g++
$ which gcc
error
1. Build folder to the wrong location stubs-32. H cannot be found, CentOS is 64 bit
compilation terminated.
make[5]: *** [_muldi3.o] Error 1
make[5]: Leaving directory ‘/home/wei/gcc-4.8.5/gcc-build-4.8.5/x86_64-unknown linux-gnu/32/libgcc’
…………………
solution: install a 32-bit glibb-devel that ignores multiple versions of a piece of software.
$ yum -y install glibc-devel.i686 –setopt=protected_multilib=false
is a new build folder in the source tree and needs to be used in a separate folder. The solution is to create a new folder outside of the source code, the resolved code has been updated to the above.
First, we highly recommend that GCC be built into a separate directory from the sources whichdoes not reside within the source tree. This is how we generally build GCC; Building where srcdir == objdir should still work, but doesn’t get extensive testing; building where objdir is a subdirectory of srcdir is unsupported.
Read More:
- Error: unrecognized command line option “-std=c++11”, to solve the problem that ubuntu does not support c++11
- Solution to command line option syntax error. Type command /? For help
- Command line option syntax error appears during software installation?
- g++: internal compiler error: Killed (program cc1plus)
- Linux running Makefile, G + + / GCC error: suffix or operations invalid for ‘vbroadcasts’
- Installing GCC reduced version GCC 4.4.6 under Linux
- gcc: error trying to exec ‘cc1‘: execvp: No such file or directory
- When NPM install, make: G + +: command not found will be prompted
- Unrecognized option: –add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
- Command line is too long. Shorten command line for QuestionnaireApplication or also for Spring Boot
- error: unrecognized argument in option ‘-mabi=apcs-gnu‘
- Solution of command line window flashback when visual studio runs C + + program
- Solution to the problem of no C / C + + option in the new project of eclipse
- [Solved] Linux C++ Compile Error: c++: internal compiler error: Killed (program cc1plus)
- Error running ‘application’: command line is too long. Short command line for application
- CONDA upgrade command: upgrade CONDA, anaconda and various packages
- command ‘gcc‘ failed with exit status 4
- There is a problem of DLL when executing G + + compile command in sublime text editor