1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

WindowsでCのコンパイル環境を構築する

Last updated at Posted at 2021-09-23

はじめに

WindowsでCのソースを修正する機会があったので、コンパイルまでの環境構築メモ

環境

  • Windows 10
  • MinGW

手順

以下のページにアクセスしよう。
https://osdn.net/projects/mingw/releases/68260 

一番下の mingw-get-setup.exeをダウンロードし、起動しよう。
image.png

以下が画面が表示されるので、「Install」ボタンをクリックしよう
image.png

以下が画面が表示されるので、「Continue」ボタンをクリックしよう
image.png

ツールのインストールが始まるのでしばらく待とう。
image.png

以下の画面が立ち上がるので、インストールしたいライブラリを選択(ここでは、mingw32-base-binとmingw32-gcc-g++-binを選択)し、「Installation」→ 「Apply Changes」を実行しよう、
image.png

Applyをクリックすると、ライブラリのインストールが始まるのでしばらく待とう。
image.png

終わったら環境変数を開いてPath変数に、インストールしたフォルダの下のbinディレクトリ(デフォルトの場合, C:\MinGW\bin)を追加しよう。
image.png

以上で準備完了。

コンパイル

適当にCのソースを用意しよう。ここでは、以下pdfの一番下にあるオイラー法のプログラムをコピペし, test.cという名前で保存

以下の通りコンパイルしよう。

gcc -o test.exe test.c

以下の通り実行しよう。

./test.ext
0.000000 1.000000
0.050000 1.000000
0.100000 0.997500
0.150000 0.992500
0.200000 0.985006
0.250000 0.975031

うまくいってるっぽい。
Hava a good a C programming life on WIndows 10!

参考

1
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?