我使用以下方法编译了 C 源代码:
gcc filename.c
它已编译,但我在源代码所在的同一目录中看不到可执行文件。但是当我使用以下命令编译程序时:
gcc filename.c -o filename
我能够看到我的可执行文件。当我使用第一种方法时,我的可执行文件存储在哪里?
答案1
如果您没有给出明确的-o
选项,则默认值应该是一个名为a.out
. GNU 编译器手册页man gcc
是这样解释的:
-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.