0

I typed the "Hello, World" program in the Ubuntu text editor.
The file, 'hello' was saved to the documents folder, which I verified, is there.

However, the "c" compiler, version 7.4.0-1, cannot find 'hello.'
Moreover, the program 'find' cannot find it either.
I would appreciate any help you can give me.

Thomas Ward
  • 74,764

1 Answers1

3

Welcome to Ask Ubuntu!

Make sure you are in the same directory in terminal as is your file hello.c. Type cd /path/to/your_folder/ in terminal to go to it.

Then, gcc hello.c -o helloout should compile it to the output file helloout. To execute the compiled code, type ./helloout.

Note: If I left the code file hello without the .c extension, gcc says

file not recognized: Unrecognized file format

Follows the example I tested (hello.c).

#include <stdio.h>

int main(){
    printf("Hello, World\n");
    return 0;
}