月城冥

gcc 命令如果不指定目标文件名时默认生成的可执行文件名为 a.out(linux)a.exe(windows)

可用 gcc [源文件名] -o [目标文件名] 来指定目标文件路径及文件名。

例如,windows 系统上,gcc hello.c -o target/hello 会在 target 目录下生成 hello.exe 文件(Linux 系统生成 hello 可执行文件),target 目录必须已存在,[源文件名] 和 -o [目标文件名] 的顺序可互换, gcc -o target/hello hello.c 依然有效。