簡體   English   中英

在 Windows 中創建 C 程序

[英]Create a C program in Windows

我想創建一個小的 C 程序,我想使用 Windows 命令提示符來編譯和運行它。 誰能建議我如何安裝與命令提示符一起使用的 C 編譯器及其使用方式? 如何安裝編譯器、編譯代碼和運行程序?

Windows 有幾個可用的編譯器。 兩個流行的是Microsoft Visual C++MinGW

使用 Visual C++,您可以像這樣編譯程序:

cl /Femyprog.exe myprog.c

使用 MinGW,您可以像這樣編譯程序:

gcc -o myprog.exe myprog.c

下載Visual Studio Express 2010 C++ 從“文件”菜單中,選擇“新建”,然后選擇“項目”。 在 Project Types 下,將樹視圖展開到 Visual C++ -> General,然后選擇 Empty Project 的模板。 給它一個名字和一個位置。 單擊確定。 輸入一些 C 代碼,然后構建並運行它。

這是一個使用起來相當簡單的工具,所以我建議您先嘗試一下 go 並嘗試一下。

大多數程序員不再使用命令提示符進行編譯。 我們改用 IDE,因為它們更方便。 話雖如此,您沒有理由不能使用命令提示符“手動”執行作為 Microsoft Visual Studio 基礎的編譯器。

所以......如果我在哪里,我會從Uncle Bills Funny Farm下載Visual Studio 2010 C++ Express Edition開始。 Note that C++ IDE (and compiler, or course) supports the old ANSI-C language as well as C++... in fact C++ is a "superset" of ANSI-C.

您的其他選項在 Windows 上有點受限。 I believe that GCC: GNU's C++ Compiler works on Windows... but it's "got a few issues" which nobody is any particular hurry to fix, simply because by far the majority of the GNU boys are running Linux, and they sort-of看不起 Windows 作為“一個有趣的實驗 [失敗]”。

干杯。 基思。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM