windows下命令行编译C程序

2020-11-03  本文已影响0人  客昂康

已安装VS2019,以hello.c为例,编译步骤如下:

#include <stdio.h>

int main(int argc, char* argv[]){
    printf("hello world ...\n");
    return 0;
}

  1. 打开 x64 Native Tools Command Prompt for VS 2019 Preview("开始"->"Visual Studio 2019"->"Visual Studio 2019"->"VC"->"x64 Native Tools Command Prompt for VS 2019 Preview"),进入"hello.c"所在目录。
  2. 执行 cl hello.c 即可。
  3. 关于 cl 编译器的详细用法,可以执行 cl /? 来查看。
上一篇 下一篇

猜你喜欢

热点阅读