WindowsにC/GCCコンパイラをインストールしてください。

プログラミング言語を学ぶ最初のステップは、システムに必要なソフトウェアをインストールすることです。このチュートリアルでは、WindowsにC/GCCコンパイラをインストールする方法を学びます。

ソースコードエディタ

C言語のソースコードを書くためには、メモ帳などの基本的なテキストエディタを選択することもできますが、以下のエディタの中から1つ選ぶことをおすすめします。

    1. Notepad++ (Windows専用)

 

    1. Microsoft Visual Studio Code (WindowsとLinux用)

 

    1. ATOM (WindowsとLinux用)

Cプログラミング初心者の場合は、EclipseやNetBeansなどのIDE(統合開発環境)を使用することもできますが、上記のテキストエディタを使うことをおすすめします。

WindowsにC/GCCコンパイラをインストールしてください。

  • One of the preferred way to install C/GCC compiler is to use CodeBlocks. Just install it, launch it and start coding to keep things simple. In other words, CodeBlocks is a free C/C++ IDE that comes with the built-in compiler.
  • Download codeblocks from www.codeblocks.org/downloads/binaries for your respective Operating System.
  • Windows users should choose download file which has “mingw” in its name, for example, codeblocks-17.12mingw-setup.exe.
  • During installation, select Type of Install as “Minimal: Important plugins, important lexers” and make sure “MinGW Compiler Suite” is Checked. This will make sure that GCC compiler is also installed with the IDE.
Codeblocks Install
Code Blocks Hello World

WindowsのためのPATH変数の設定

Codeblocksがインストールされると、GCCコンパイラも一緒にインストールされます。しかし、コマンドプロンプトからCプログラムを実行したい場合は、そのbinディレクトリをPATH変数に追加する必要があります。

    1. インストールディレクトリに移動し、binフォルダのパスをコピーしてください。例:「C:\Program Files (x86)\CodeBlocks\MinGW\bin」

 

    「コントロールパネル\System and Security\System」に移動し、「高度なシステム設定」をクリックしてから「環境変数」を選択してください。
Computer Properties
    ユーザーまたはシステム(管理者の場合)の変数で変数名「パス」を探し、編集をクリックしてください。
  • If you see a small popup, In “Variable value” box, go to end of text, put a semicolon “;” and paste the path of bin folder i.e. “C:\Program Files (x86)\CodeBlocks\MinGW\bin”
  • If you see a big popup (usually in windows 10) with the list of Path variables, click on “New” and paste the “bin” folder path.
    1. すべての開いたポップアップウィンドウでOKを押してください。

 

    1. コマンドプロンプトを開き、「gcc」と入力し、エンターキーを押してください。

「gcc: fatal error: no input files compilation terminated.」と表示された場合、GCCは正常にインストールされていることを意味し、コマンドプロンプトを終了することができます。
「’gcc’ is not recognized as an internal or external command」というメッセージが表示された場合は、パスの設定とインストール手順を正しく実行してください。

WindowsでC/GCCコンパイラをインストールする方法については以上です。これでC言語のコーディング機能を探索する準備が整いました。

コメントを残す 0

Your email address will not be published. Required fields are marked *