I can't compile a C file in Ubuntu 18.04.
In terminal I used this command:
$ gcc -o abc.o abc.c -lm
, but it says that gcc is not found.
This exact command can compile a C program in Ubuntu 16.04 (which I used earlier).
Can anyone help how to fix this? As far as I knew that gcc was the compiler by default in Ubuntu. But in 18.04 things seem different. What happened to 18.04? Thanks!
The error you're getting is an indications that the
gcc
package either isn't installed or isn't installed correctly.These symptoms can happen after a fresh install before an update and upgrade.
The resolution is to complete the install with:
Unless you inadvertently removed it, it's installed automatically with Ubuntu 18.04 just as it was with 16.04. So the first two commands above should correct the issue.
This issue happens with a number of packages that needs upgrades and updates after a fresh install.