How to compile C program file in Ubuntu 18.04

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
1
down vote

favorite
1












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!







share|improve this question






















  • So does Bionic have gcc, have you checked?
    – George Udosen
    May 8 at 15:34










  • I don't know. But How? @George
    – Debajyoti
    May 8 at 15:41














up vote
1
down vote

favorite
1












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!







share|improve this question






















  • So does Bionic have gcc, have you checked?
    – George Udosen
    May 8 at 15:34










  • I don't know. But How? @George
    – Debajyoti
    May 8 at 15:41












up vote
1
down vote

favorite
1









up vote
1
down vote

favorite
1






1





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!







share|improve this question














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!









share|improve this question













share|improve this question




share|improve this question








edited May 8 at 18:20

























asked May 8 at 15:26









Debajyoti

1401111




1401111











  • So does Bionic have gcc, have you checked?
    – George Udosen
    May 8 at 15:34










  • I don't know. But How? @George
    – Debajyoti
    May 8 at 15:41
















  • So does Bionic have gcc, have you checked?
    – George Udosen
    May 8 at 15:34










  • I don't know. But How? @George
    – Debajyoti
    May 8 at 15:41















So does Bionic have gcc, have you checked?
– George Udosen
May 8 at 15:34




So does Bionic have gcc, have you checked?
– George Udosen
May 8 at 15:34












I don't know. But How? @George
– Debajyoti
May 8 at 15:41




I don't know. But How? @George
– Debajyoti
May 8 at 15:41










1 Answer
1






active

oldest

votes

















up vote
2
down vote



accepted










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:



$ sudo apt update
$ sudo apt upgrade
$ sudo apt install gcc


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.






share|improve this answer




















  • Thanks! It needed fresh install of gcc. $ sudo apt install gcc worked for me
    – Debajyoti
    May 8 at 15:52











  • Thanks for the acknowledgment that is worked. You can contribute back to the community by clicking the checkmark of the answer. This will do a number of things. It'll let people having similar issues easily find workable resolutions... it'll also reward both the person supplying the answer and the new user.
    – L. D. James
    May 8 at 15:57











  • is in not better to just install build-essential?
    – Joshua Besneatte
    May 8 at 16:00










  • @JoshuaBesneatte The package build-essential is installed by default, just as gcc. In this case the problem was with the gcc command.
    – L. D. James
    May 8 at 16:56










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1033642%2fhow-to-compile-c-program-file-in-ubuntu-18-04%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
2
down vote



accepted










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:



$ sudo apt update
$ sudo apt upgrade
$ sudo apt install gcc


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.






share|improve this answer




















  • Thanks! It needed fresh install of gcc. $ sudo apt install gcc worked for me
    – Debajyoti
    May 8 at 15:52











  • Thanks for the acknowledgment that is worked. You can contribute back to the community by clicking the checkmark of the answer. This will do a number of things. It'll let people having similar issues easily find workable resolutions... it'll also reward both the person supplying the answer and the new user.
    – L. D. James
    May 8 at 15:57











  • is in not better to just install build-essential?
    – Joshua Besneatte
    May 8 at 16:00










  • @JoshuaBesneatte The package build-essential is installed by default, just as gcc. In this case the problem was with the gcc command.
    – L. D. James
    May 8 at 16:56














up vote
2
down vote



accepted










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:



$ sudo apt update
$ sudo apt upgrade
$ sudo apt install gcc


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.






share|improve this answer




















  • Thanks! It needed fresh install of gcc. $ sudo apt install gcc worked for me
    – Debajyoti
    May 8 at 15:52











  • Thanks for the acknowledgment that is worked. You can contribute back to the community by clicking the checkmark of the answer. This will do a number of things. It'll let people having similar issues easily find workable resolutions... it'll also reward both the person supplying the answer and the new user.
    – L. D. James
    May 8 at 15:57











  • is in not better to just install build-essential?
    – Joshua Besneatte
    May 8 at 16:00










  • @JoshuaBesneatte The package build-essential is installed by default, just as gcc. In this case the problem was with the gcc command.
    – L. D. James
    May 8 at 16:56












up vote
2
down vote



accepted







up vote
2
down vote



accepted






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:



$ sudo apt update
$ sudo apt upgrade
$ sudo apt install gcc


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.






share|improve this answer












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:



$ sudo apt update
$ sudo apt upgrade
$ sudo apt install gcc


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.







share|improve this answer












share|improve this answer



share|improve this answer










answered May 8 at 15:40









L. D. James

17.4k43178




17.4k43178











  • Thanks! It needed fresh install of gcc. $ sudo apt install gcc worked for me
    – Debajyoti
    May 8 at 15:52











  • Thanks for the acknowledgment that is worked. You can contribute back to the community by clicking the checkmark of the answer. This will do a number of things. It'll let people having similar issues easily find workable resolutions... it'll also reward both the person supplying the answer and the new user.
    – L. D. James
    May 8 at 15:57











  • is in not better to just install build-essential?
    – Joshua Besneatte
    May 8 at 16:00










  • @JoshuaBesneatte The package build-essential is installed by default, just as gcc. In this case the problem was with the gcc command.
    – L. D. James
    May 8 at 16:56
















  • Thanks! It needed fresh install of gcc. $ sudo apt install gcc worked for me
    – Debajyoti
    May 8 at 15:52











  • Thanks for the acknowledgment that is worked. You can contribute back to the community by clicking the checkmark of the answer. This will do a number of things. It'll let people having similar issues easily find workable resolutions... it'll also reward both the person supplying the answer and the new user.
    – L. D. James
    May 8 at 15:57











  • is in not better to just install build-essential?
    – Joshua Besneatte
    May 8 at 16:00










  • @JoshuaBesneatte The package build-essential is installed by default, just as gcc. In this case the problem was with the gcc command.
    – L. D. James
    May 8 at 16:56















Thanks! It needed fresh install of gcc. $ sudo apt install gcc worked for me
– Debajyoti
May 8 at 15:52





Thanks! It needed fresh install of gcc. $ sudo apt install gcc worked for me
– Debajyoti
May 8 at 15:52













Thanks for the acknowledgment that is worked. You can contribute back to the community by clicking the checkmark of the answer. This will do a number of things. It'll let people having similar issues easily find workable resolutions... it'll also reward both the person supplying the answer and the new user.
– L. D. James
May 8 at 15:57





Thanks for the acknowledgment that is worked. You can contribute back to the community by clicking the checkmark of the answer. This will do a number of things. It'll let people having similar issues easily find workable resolutions... it'll also reward both the person supplying the answer and the new user.
– L. D. James
May 8 at 15:57













is in not better to just install build-essential?
– Joshua Besneatte
May 8 at 16:00




is in not better to just install build-essential?
– Joshua Besneatte
May 8 at 16:00












@JoshuaBesneatte The package build-essential is installed by default, just as gcc. In this case the problem was with the gcc command.
– L. D. James
May 8 at 16:56




@JoshuaBesneatte The package build-essential is installed by default, just as gcc. In this case the problem was with the gcc command.
– L. D. James
May 8 at 16:56












 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1033642%2fhow-to-compile-c-program-file-in-ubuntu-18-04%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

pylint3 and pip3 broken

Missing snmpget and snmpwalk

How to enroll fingerprints to Ubuntu 17.10 with VFS491