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?


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.