>gcc --version
gcc (x86_64-posix-seh-rev2, Built by MinGW-W64 project) 6.3.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
使用mingw.mlpkginstall爲MATLAB R2018B安裝MINGW編譯器,在命令行顯示gcc的版本號,發現對應的gcc 6.3.0(x86_64-posix-seh-rev2, Built by MinGW-W64 project),由於MATLAB R2018B中使用mingw.mlpkginstall安裝速度十分緩慢,並且失敗機率很大,大家可以直接去網站上下載文件:x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z,下載地址爲:
下載完成後,解壓縮到C:\ mingw-w64目錄中:
1.將C:\ mingw-w64\mingw64加到系統路徑PATH中;
2.設置環境變量MW_MINGW64_LOG,變量值爲C:\ mingw-w64\mingw64
3.在MATLAB命令行中setenv('MW_MINGW64_LOC', 'C:\ mingw-w64\mingw64')
4.在MATLAB命令行中:mex -setup,選擇MINGW C++編譯器即可.
具體可見百度:
https://jingyan.baidu.com/article/c843ea0b414cad37921e4a62.html