Issue
I have tried all the solutions of similar questions and none works.
I have installed gcc in /usr/local/bin and this my PATH variable
echo $PATH
/usr/local/gcc-12.1.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
But when i run gcc --version command, my linux can't find it, why?
gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
It still points to the older 9.4.0 version. Could someone help me use the new version of the gcc compiler.
Thanks!
Solution
You should use update-alternatives tool to install gcc-12 as an alternative and to make it the default one.
Answered By - ropieur Answer Checked By - Candace Johnson (WPSolving Volunteer)