以下を使用してCソースコードをコンパイルしました。
gcc filename.c
コンパイルされますが、ソースコードを含む同じディレクトリに実行可能ファイルは表示されません。ただし、次のようにプログラムをコンパイルする場合:
gcc filename.c -o filename
実行可能ファイルを表示できます。最初の方法を使用すると、実行可能ファイルはどこに保存されますか?
ベストアンサー1
明示的なオプションを指定しない場合、デフォルトは-o
GNUa.out
コンパイラのマニュアルページで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.