Reputation: 31
I have written a simple helloworld.c
program. I can compile it and run it on linux terminal using gcc
and ./a.out
command. My query is regarding calling .o file without any extension. For example, to run my program instead of typing "./helloworld.out"
, I want to run it using keyword "helloworld"
on my terminal. Any hints???
Thank You.
Upvotes: 0
Views: 105
Reputation: 47824
Just compile using
gcc -o helloworld helloworld.c
The -o
option is for the output file name
Then use:
./helloworld
You need the ./
to tell the shell where the executable resides, since the current directory is unlikely to be in $PATH
.
Upvotes: 2