从Windows命令提示符编译的C code? [英] Compiling C-code from the Command Prompt in Windows?

查看:196
本文介绍了从Windows命令提示符编译的C code?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Windows命令提示符编译C code。我已经添加了环境变量PATH和我可以编译的.cs与文件: CSC app.cs

I want to compile C code from the Command Prompt in Windows. I have added the environment variable to the PATH and I can compile .cs files with: csc app.cs

这是确定的,但我怎么编译app.c?

That's OK, but how do I compile app.c?

推荐答案

您做到这一点:

cl app.c

下面是一个完整的成绩单,包括Visual Studio 2005中设置环境(改变8到9.0为Visual Studio 2008)。

Here's a complete transcript, including setting up the environment for Visual Studio 2005 (change "8" to "9.0" for Visual Studio 2008).

C:\src\tests>"\Program Files (x86)\Microsoft Visual Studio 8\vc\bin\vcvars32.bat"
Setting environment for using Microsoft Visual Studio 2005 x86 tools.

C:\src\tests>type app.c
#include <stdio.h>
int main(void)
{
    printf("Hello world!\n");
    return 0;
}

C:\src\tests>cl app.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86

Copyright (C) Microsoft Corporation.  All rights reserved.

app.c
Microsoft (R) Incremental Linker Version 8.00.50727.762
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:app.exe
app.obj

C:\src\tests>app
Hello world!

这篇关于从Windows命令提示符编译的C code?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆