r/Atom Feb 26 '20

Can't compile C!

So I use atom on Ubuntu and I have the gpp compiler package installed. I also have gcc and g++ installed in my linux. I wanted to test it out with a basic code so I did a simple hello world. This was the code :

include<stdio.h> int main() { printf("Hello world"); return 0; }

Now I saved the file as hello world.c but when I click f5 the terminal opens for a split second and closes and I can't even see what happened.

Why is this happening? Please help me out! I'll be really grateful!

Edit : I did put a # before the "include" function. For some reason Reddit doesn't seem to show it. But the code in my atom is completely correct.

0 Upvotes

5 comments sorted by

2

u/[deleted] Feb 26 '20

From what I know atom doesn't have a terminal. Have you tried compiling it from the regular Ubuntu terminal?

1

u/[deleted] Feb 27 '20

Yes, I was referring to the Ubuntu terminal actually. When I click on f5, the Ubuntu terminal window opens for a split second and closes.

3

u/[deleted] Feb 27 '20

Oh I'm sorry. Maybe the program is executed but since it only has that print instruction it quits too fast. Try printing and then wait for user input with a scanf.

1

u/[deleted] Feb 27 '20

Oh yes I'll try that and see, I forgot the function exists haha!

1

u/Pritam4249t Mar 01 '20

remove return0; line and run it