Install g ++ 4.8 sudo apt-get install python-software-properties
Sudo add-apt-repository ppa: ubuntu-toolchain-r/test
Sudo apt-get update
Sudo apt-get install g ++-4.8
Sudo update-alternatives -- install/usr/bin/g ++-4.8 50
Finally, check the version number of g ++ to see if the installation is successful.
Configure global compilation parameters: Select eclipse toolbar Project> Properties> C/C ++ Build> Settings> Miscellaneous. add-std = c ++ 11 to Other flags on the right, right-click the target project and choose Properties> C/C ++ Build> Settings> Miscellaneous. add-std = c ++ 11 to Other flags on the right to configure the indexer of eclipse CDT. It is convenient for the editor to correctly parse the keywords and symbols of C ++ 11.
Select eclipse toolbar Project-> Properties-> C/C ++ General-> Preprocessor Include Paths, Macros etc .:
- Select the tab "Providers"
- Select Debug in the Configuration column ("Release" can be configured later ")
- On the "Providers" tab, select "cdt gcc Built-in Compiler Settings ".
- Uncheck Use global provider shared between projects.
- Add "-std = c ++ 11" (without quotation marks) to the Command to get compiler specs column );
- Select apply and OK.
- Finally re-build C/C ++ indexer. Project-> C/C ++ Index-> Rebuild. reference article http://askubuntu.com/questions/271388/how-to-install-gcc-4-8-in-ubuntu-12-04-from-the-terminalhttps://gist.github.com/omnus/6404505http://stackoverflow.com/a/17499266http://stackoverflow.com/a/15321753