WindowsにC言語の開発環境を整えようと思い、
MinGWをMinGW-w64からダウンロード&インストールしようとしました。
しかし問題が発生。
インストール中に"The file has been downloaded incorrectly!"と表示される
これです。
ググったところ他にも同じところで詰まっている方が結構居ました。
開発者権限で実行するとか、再度ダウンロードするとか、一般的な対応方法ではうまくいかないようです。(私もダメでした。)
公式からのダウンロード&インストールを諦めて、Scoopを使ったところうまくいきました。
ScoopでMinGWを入れる
Scoopとは
A command-line installer for Windows
です。apt
とかhome-brew
だ、と思えばいいです。
インストールがまだの方は以下記事参照してインストールしてください。
参考:Windows用コマンドラインインストーラのScoopを使う - Qiita
インストールが済んだら、Scoopを使って入れたいもの、を先の公式ページから検索してみます。
MinGWもちゃんとScoopにありましたので、書いてあるコマンド
scoop install mingw
を実行。
PS C:\Users\yoshiki.ito> scoop install mingw
Installing 'mingw' (8.1.0) [64bit]
x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z (47.1 MB) [==========================================================] 100%
Checking hash of x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z ... ok.
Extracting x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z ... done.
Linking ~\scoop\apps\mingw\current => ~\scoop\apps\mingw\8.1.0
Running post_install script...
'mingw' (8.1.0) was installed successfully!
Notes
-----
- You are installing the Mingw-w64 implementation of GCC.
This implementation has a better compatibility, but may not support newer C/C++ standards.
For more recent GCC versions, try 'mingw-winlibs' or 'mingw-nuwen'.
インストールが無事完了しました。
Scoopから入れておけば管理も楽ですし、違うやり方がどうしてもうまくいかない、という場合はScoop使うのはアリです。
念のためgcc --help
でインストールできていることを確認
PS C:\Users\yoshiki.ito> gcc --help
Usage: gcc.exe [options] file...
Options:
-pass-exit-codes Exit with highest error code from a phase.
--help Display this information.
--target-help Display target specific command line options.
--help={common|optimizers|params|target|warnings|[^]{joined|separate|undocumented}}[,...].
Display specific types of command line options.
(Use '-v --help' to display command line options of sub-processes).
※以下略
問題なさそうです。