How to install MinGW-w64 C/C++ compiler for use in MATLAB 2016b?

孤街醉人 提交于 2019-12-11 04:31:05

问题


I am installing the MinGW-w64 C/C++ compiler for use in MATLAB 20176b but there is several errors for that. How can install this compiler with all the necessary adjustments to use in Matlab 2016b?

As the first way directly from Matlab:

  1. Downloaded the MinGW-w64 C/C++ compiler for Windows from here: https://www.mathworks.com/matlabcentral/fileexchange/52848-matlab-support-for-mingw-w64-c-c++-compiler

  2. After running true Matlab and approval for installation and installing the packages, it gives an error as:

There was a problem installing the third-party software. To resolve this issue, contact Technical Support

The second approach is to install the MinGW-w64 C/C++ compiler separately and then adjust to use in Matlab. But After installation Matlab doesn't recognize it.


回答1:


The details provided on Matlab not recognizing the MinGW installation are a bit vague, but I'll take a shot at it.

When installing MinGW, the default installation directory is one with spaces in the path (Program Files). For some reason, this is not supported by Matlab (https://www.mathworks.com/help/matlab/matlab_external/compiling-c-mex-files-with-mingw.html):

Do not install MinGW in a location with spaces in the path name. For example, do not use: C:\Program Files\TDM-GCC-64

In my situation, I installed MinGW directly on the C drive. As such, my installation directory has the following layout:

C:\mingw64

  • C:\mingw64\bin
  • C:\mingw64\etc
  • C:\mingw64\*...

Once that is installed, all you need to do is point Matlab to the installation directory, in my case, I need to run the following command:

setenv('MW_MINGW64_LOC','C:\mingw64')

After that, you should be squared away to run the mex compilation command.



来源:https://stackoverflow.com/questions/45073791/how-to-install-mingw-w64-c-c-compiler-for-use-in-matlab-2016b

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!