Wednesday 2 September 2015

compile using c++14 in ubuntu

The current GCC in the ubuntu repository doesn’t support the C++14 standard. To use the C++14 install the GCC has to be updated manually. It can be found in the Ubuntu Toolchain PPA. After this, the C++ compiler can be updated. The following commands show how to add the repository and install the compiler:

root$sudo add-apt-repository ppa:ubuntu-toolchain-r/test
root$sudo apt-get update
root$sudo apt-get install g++-4.9
check whether g++-4.9 is installed..
root$g++-4.9
 






now check which version is there in your pc





root$sudo ln -f -s /usr/bin/g++-4.9 /usr/bin/g++
now check the version
root$g++ -v
you must see something like

thats means its done :) now compile your file using.

root$g++ -std=c++14 code.cpp

"code.cpp type your file name"

1 comment: