I am having trouble compiling and running my C program. What are the commands?
My code is:
#include <stdio.h>
int main(){
printf("Hello World!\n");
exit(0);
}
I tried compiling with
gcc -o hello.c
only to be unsuccessful. I am using a Mac terminal, if that matters.
In
gcc
, option-o
is used to specify a custom output filename. The immediate next argument should be the file name.A simple revised command will be
where,
hello
is the name of the binary.You can check the online gcc manual for more info.