Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/61.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么我会得到一个;a、 exe";而不是",;a、 “出去”;关于windowc编程_C_Compilation - Fatal编程技术网

为什么我会得到一个;a、 exe";而不是",;a、 “出去”;关于windowc编程

为什么我会得到一个;a、 exe";而不是",;a、 “出去”;关于windowc编程,c,compilation,C,Compilation,当我通过cc hello\u world.c编译下面的“hello\u world.c”时, 它生成一个“a.exe”而不是“a.out” #include <stdio.h> main() { printf("hello, world\n"); } #包括 main() { printf(“你好,世界”\n); } “a.out”和“a.exe”之间有什么区别 为什么我得到的是“a.exe”而不是“a.out” Windows中的二进制执行文件具有扩展名exe。我不确

当我通过cc hello\u world.c编译下面的“hello\u world.c”时,
它生成一个“a.exe”而不是“a.out”

#include <stdio.h>

main()
{
    printf("hello, world\n");
}
#包括
main()
{
printf(“你好,世界”\n);
}
  • “a.out”和“a.exe”之间有什么区别
  • 为什么我得到的是“a.exe”而不是“a.out”

  • Windows中的二进制执行文件具有扩展名
    exe
    。我不确定
    com
    -文件是否支持,但这不是我们的情况。Extension
    out
    通常用于在某些程序运行时编写文本协议。我猜是你的程序本身在启动时创建了
    out
    -文件。要获得更多帮助,请至少提供编译C程序所使用的程序环境。

    这取决于您的平台。例如,
    gcc
    将在linux上生成
    .out
    ,在windows上生成
    .exe
    ,如果您不给它任何附加参数。(即运行
    cc/gcc“source”

    您可以强制
    gcc
    在带有
    gcc“source”-o“dest.out”
    的windows上生成
    .out

    如果您的编译器默认输出一个扩展名(在您的情况下,
    .exe
    似乎是默认值,对于Windows来说完全可以),我会坚持使用它。不必担心得不到另一种类型。

    在编译c程序后创建的临时文件实际上是类Unix操作系统的一种。目标代码用于编写系统调用,系统调用实现链接器的代码功能和重定位信息,以帮助链接器在内存中查找目标代码(更多信息)

    编译器编译代码并编写一个称为目标代码的文件,在linux/unix中,该文件称为。 此文件可以进一步扩展到操作系统中存在的定义(或更严格地说),以形成可执行映像

    例如在Windows中:

    这取决于编译器及其设置。说明编译器及其设置,因为可执行文件在Windows上有.exe扩展名,但在其他平台上没有。很抱歉,我如何检查编译器的版本?我在windows 10上安装了visual studio 2015,并将代码编译为“cc hello_world.c”阅读:用户正在写“我在windows 10上安装了visual studio 2015,并将代码编译为“cc hello_world.c”,所以是windows…我修改了问题。谢谢。投票否决我答案的人可能想解释原因。