4

I have compiled my C source code using:

gcc filename.c 

It got compiled, but I cannot see the executable in the same directory where my source code is. But when I compile my program using:

gcc filename.c -o filename 

I was able to see my executable file. When I used the first method, where was my executable stored?

0

1 Answer 1

4

If you don't give an explicit -o option, the default should be a file called a.out. The GNU compiler manual page man gcc explains it thus:


-o file
    Place output in file file.  This applies to whatever sort of output
    is being produced, whether it be an executable file, an object
    file, an assembler file or preprocessed C code.

    If -o is not specified, the default is to put an executable file in
    a.out, the object file for source.suffix in source.o, its assembler
    file in source.s, a precompiled header file in source.suffix.gch,
    and all preprocessed C source on standard output.

You must log in to answer this question.

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