i have already installed gcc and its found in path(gcc: /usr/lib/gcc /usr/share/man/man1/gcc.1.gz). But when i want to use the gcc it says: Command 'gcc' not found, but can be installed with: sudo apt install gcc

and i try to install it but still its not working,,output after i install is: Reading package lists... Done

Building dependency tree

Reading state information... Done

gcc is already the newest version (4:7.3.0-3ubuntu2.1).

0 to upgrade, 0 to newly install, 0 to remove and 8 not to upgrade. if anybody know this please help

forexample If I run this command; gcc --version its output is

Command 'gcc' not found, but can be installed with: sudo apt install gcc why does this happen,since i have seen gcc in the path: gcc: /usr/lib/gcc /usr/share/man/man1/gcc.1.gz

  • 2
    And how are you trying to use it and what does which gcc say? Lets us see exact command! – George Udosen Nov 30 '18 at 7:16
  • 1
    /usr/lib/gcc is not on the executable search PATH - it sounds like you've broken the symbolic link /usr/bin/gcc (which should point to the default version for your system - such as gcc-7) – steeldriver Nov 30 '18 at 7:37
  • fyi: my whereis gcc reports "gcc: /usr/bin/gcc /usr/lib/gcc /usr/share/man/man1/gcc.1.gz" (/usr/bin/ being in my $PATH), with a file /usr/bin/gcc reporting "/usr/bin/gcc: symbolic link to gcc-8" as @steeldriver indicated (my /usr/lib/gcc is a directory (of directories)) – guiverc Nov 30 '18 at 8:10
  • If it is a missing symlink, then it may be sufficient to reinstall the package: sudo apt-get install --reinstall gcc – steeldriver Nov 30 '18 at 11:53
  • tnx steeldriver,, sudo apt-get install --reinstall gcc works – getch Dec 1 '18 at 7:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.