apt - "gcc --version" can't find gcc despite having g++-5 and gcc-5 installed? - Ask Ubuntu


i want have gcc-5 because want c++14 support. removed previous versions of gcc; gcc-4.8 , gcc-4.9 , installed gcc-5 , g++-5. when command gcc --version replies:

the program 'gcc' not installed. can install typing: sudo apt-get install gcc 

on other hand, if command sudo apt-get install gcc-5, reply gcc-5 newest version. if command sudo apt-get install gcc tries take gcc-4.8.

why behaviour? how can ensure gcc-5 when command sudo apt-get install gcc.

thanks.

it bad update libraries testing ppa, unless know you're doing.

you're not getting response gcc --version because don't have gcc program version 5.x available in current apt-repositories. package-manager (here apt) have maintained 2 different packages same program different versions 4.x , 5.x.

you can't gcc-5 when type sudo apt-get install gcc because try package named gcc not gcc-5 list of repositories defined apt. instead suggest gcc-5 , replace gcc or replacing alias in ~/.bashrc file.

if want replace gcc-5 gcc can try gist link. or mainly

sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get install gcc-5 g++-5  sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5 

a less recommended option add

alias gcc='gcc-5 

in ~/.bashrc. use gcc-5 when use terminal , other calls gcc won't trigger gcc-5.


Comments

Popular posts from this blog

download - Firefox cannot save files (most of the time), how to solve? - Super User

windows - "-2146893807 NTE_NOT_FOUND" when repair certificate store - Super User