<分区>
当我通过 cc hello_world.c 编译下面的“hello_world.c”时,
它生成一个“a.exe”而不是“a.out”
#include <stdio.h>
main()
{
printf("hello, world\n");
}
- “a.out”和“a.exe”有什么区别?
- 为什么我得到的是“a.exe”而不是“a.out”?
标签 c compilation
<分区>
当我通过 cc hello_world.c 编译下面的“hello_world.c”时,
它生成一个“a.exe”而不是“a.out”
#include <stdio.h>
main()
{
printf("hello, world\n");
}
最佳答案
这取决于您的平台。例如gcc
将产生 .out
在 Linux 上,和 .exe
在 Windows 上,如果你不给它任何额外的参数。 (即运行 cc / gcc "source"
)。
你可以强制gcc
产生一个.out
在带有 gcc "source" -o "dest.out"
的 Windows 上.
如果您的编译器默认输出一个扩展名(在您的情况下,.exe
似乎是默认值,这对于 Windows 来说是完全可以的),我会坚持使用它。无需担心找不到其他类型。
关于c - 为什么我在窗口 C 编程中得到 "a.exe"而不是 "a.out",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47377488/