문제

Windows의 명령 프롬프트에서 C 코드를 컴파일하고 싶습니다. 환경 변수를 경로에 추가했으며 .CS 파일을 다음과 같이 컴파일 할 수 있습니다. csc app.cs

괜찮지 만 app.c를 어떻게 컴파일합니까?

도움이 되었습니까?

해결책

당신은 이것을합니다 :

cl app.c

Visual Studio 2005 환경 설정을 포함한 완전한 성적표가 있습니다 (Visual Studio 2008의 경우 "8"을 "9.0"으로 변경).

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!

다른 팁

mingw Windows 용 인기있는 명령 줄 GCC 컴파일러를 제공합니다.

  • 열린 명령 프롬프트
  • 유형 path c:\tc\bin
  • 명령 프롬프트에서 프로젝트 폴더를 얻었습니다
  • 유형 tcc filename.c
  • 컴파일 유형 후 filename
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top