The cause of this compilation error is not high enough in the g++ GCC version.
Add the source
$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test
$ sudo apt-get update
Install version 4.8
$ sudo apt-get install gcc-4.8 g++-4.8
View the local installation version
$ ls -lh /usr/bin/g++*
You should see that 4.6 and 4.8 are shipped.
Switch version
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8
$ sudo update-alternatives --config gcc
here select version 4.8 serial number
Check the g++ version again
$ g++ --version
Confirm that the current version is 4.8, the problem has been solved!
From: http://my.oschina.net/chenyoca/blog/226455
Read More:
- cenos Upgrade g++ gcc(cc1plus: error: unrecognized command line option “-std=c++11”)
- Solution to the problem of no C / C + + option in the new project of eclipse
- Solution to command line option syntax error. Type command /? For help
- To solve the running error of eclipse for C / C + +: launch failed binary not found
- Debugging failed under vscode Ubuntu, unable to open libc-start. C raise. C, etc
- Solve the problem of error: cannot pass objects of non trivially copyable type ‘STD:: String’ in C / C + +
- Several ways for Ubuntu to open command line terminal window
- Solve the problem that WSL occupies too much C disk
- How to Solve apt get update problem: usr/lib/apt/methods/HTTPS could not be found_PUBKEY 7EA0A9C3F273FCD8
- Solution of command line window flashback when visual studio runs C + + program
- Command line option syntax error appears during software installation?
- Quartus ii 13.1 compilation does not pass: Error (119013): Current license file does not support the EP4CE10F17C8 device
- C language string processing error warning, c4996, sprintf, predicted, c4996, strcpy, c4996, strcat
- The language of C__ FILE__ 、__ LINE__ And line
- C language — to solve the problem of program flashback when programming (in VS)
- Solve the problem of MySQL 1251 client does not support
- Install python’s C extension compilation environment under windows (solve “error: command’cl.exe’ failed: No such file or directory”)
- Install Python C extension compiler environment under windows (solve “error: command” cl.exe ‘ failed: No such file or directory”)
- Configuring C + + environment with atom under ubuntu1404