0

After a c program is compiled it is stored in ./a.out.

Is there any way in which I can change the file to any name I want?

4
  • Location or file name, which?
    – Tim
    Aug 19, 2015 at 20:01
  • the file name of the compiled program Aug 19, 2015 at 20:03
  • What command do you run for it to be saved as ./a.out?
    – Tim
    Aug 19, 2015 at 20:04
  • gcc (the file name ).c Aug 19, 2015 at 20:05

1 Answer 1

3

Depends on the compiler. For the GCC family (gcc, g++, etc.), you can use the -o option. The following creates an executable name blah:

gcc foo.c -o blah
1
  • 1
    +1 clang and clang++ maintain this convention AFAIK Aug 19, 2015 at 20:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .