How to compile C program file in Ubuntu 18.04
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
1
down vote
favorite
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!
gnome-terminal 18.04 gcc c
add a comment |Â
up vote
1
down vote
favorite
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!
gnome-terminal 18.04 gcc c
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
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
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!
gnome-terminal 18.04 gcc c
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!
gnome-terminal 18.04 gcc c
edited May 8 at 18:20
asked May 8 at 15:26
![](https://i.stack.imgur.com/mCj3t.jpg?s=32&g=1)
![](https://i.stack.imgur.com/mCj3t.jpg?s=32&g=1)
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
add a comment |Â
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
add a comment |Â
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.
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 packagebuild-essential
is installed by default, just asgcc
. In this case the problem was with thegcc
command.
â L. D. James
May 8 at 16:56
add a comment |Â
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.
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 packagebuild-essential
is installed by default, just asgcc
. In this case the problem was with thegcc
command.
â L. D. James
May 8 at 16:56
add a comment |Â
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.
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 packagebuild-essential
is installed by default, just asgcc
. In this case the problem was with thegcc
command.
â L. D. James
May 8 at 16:56
add a comment |Â
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.
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.
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 packagebuild-essential
is installed by default, just asgcc
. In this case the problem was with thegcc
command.
â L. D. James
May 8 at 16:56
add a comment |Â
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 packagebuild-essential
is installed by default, just asgcc
. In this case the problem was with thegcc
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
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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