WindowsのVisual Studio CodeでMinGWを使ってGNU Makeをインストールする方法について説明する
エディション Windows 10 Home
バージョン 21H2
インストール日 2022/02/14
OS ビルド 19044.1526
エクスペリエンス Windows Feature Experience Pack 120.2212.4170.0
MinGWのMake のインストール
MinGWをインストールすると,GNU Makeも同時にインストールされている
この記事に従ってMinGWをインストールすればVisual Studio CodeでMinGWが使えるようになっているはずなので,後は少し設定をいじるだけでGNU Makeが使えるようになる
ちなみに,インストールされたMinGWのPATHは「C:\Program Files (x86)\x86_64-8.1.0-release-posix-seh-rt_v6-rev0\mingw64\bin」になっている
Visual Studio Code で CMake を使えるようにする
Visual Studio Code を開き、拡張機能を開く(Ctrl+Shift+X)
左上の検索窓に「CMake」と入力し、上から「CMake」「CMake Tools」という名前の拡張機能の「インストール」をクリックする

左下の歯車のマークをクリックして「設定」を開く

上の検索窓に「Make Path」と入力して,「Makefile: Make Path」を見つける

「Makeツールへのパス」にMinGWのPATH(C:\Program Files (x86)\x86_64-8.1.0-release-posix-seh-rt_v6-rev0\mingw64\bin)を入力する

エクスプローラーを開き,「C:\Program Files (x86)\x86_64-8.1.0-release-posix-seh-rt_v6-rev0\mingw64\bin」にある「mingw32-make.exe」を見つける

「mingw32-make.exe」のコピーを作成し,ファイル名を「make.exe」に変更する
※警告がいっぱい出てくるがすべて「続行」する

以上でMinGWのGNU MakeをVisual Studio Codeで使うための準備は完了である
インストールできているか確認する
きちんとインストールできたかどうかを確認するために、Visual Studio Code を開き、エクスプローラーを開く(Ctrl+Shift+E)
「フォルダーを開く」をクリックする

「Ctrl+@」でターミナルを開く
CMakeがインストールできているかを「make --version」コマンドで確認する
PS C:\Users\mtkbirdman> make --version
GNU Make 4.2.1
Built for x86_64-w64-mingw32
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
PS C:\Users\mtkbirdman>
できた

まとめ
WindowsのVisual Studio CodeでMinGWのGNU Makeをインストールする方法について説明した
↓関連記事
コメント