Home > Back-end >  Why can't I use gcc-9.3.0 on Linux?
Why can't I use gcc-9.3.0 on Linux?

Time:09-16

I installed gcc-9.3.0 by apt, but I can only use it with sudo like

sudo gcc --version
gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO 
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

and

gcc --version
gcc (OpenFOAM) 6.3.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I want to use it without sudo. What is the difference? How can I use gcc-9.3.0 from my normal user account?

CodePudding user response:

GCC doesn't need special sudo rights - the difference you see is because you have 2 versions installed, but version 6 appears in your regular PATH before version 9.

To fix it, add the install directory of GCC 9 to the front of your PATH.

  • Related