Can the MinGW compiler obtained using the MinGW Add-On be used for compiling Fortran MEX files?
MATLAB: Can the MinGW compiler obtained using the MinGW Add-On be used for compiling Fortran MEX files
fortranMATLABmexmingwnotsupported
Related Solutions
1) The first issue you are facing can sometimes occur if the third-party site is not reachable. For more information about this issue, look into the following MATLAB Answers post:
2) As MATLAB detects the MinGW Compiler through Environment Variable 'MW_MINGW64_LOC', verify if it is set properly by running the following command:
mex -v -setup C
If MinGW is configured correctly, the output of the above command should be along the following lines, while looking for MinGW:
... Looking for compiler 'MinGW64 Compiler (C)' ...... Looking for environment variable 'MW_MINGW64_LOC' ...Yes('C:\MATLAB\SupportPackages\R2016a\MW_MinGW_4_9').... Looking for file 'C:\MATLAB\SupportPackages\R2016a\MW_MinGW_4_9\bin\gcc.exe' ...Yes.... Looking for folder 'C:\MATLAB\SupportPackages\R2016a\MW_MinGW_4_9' ...Yes.Found installed compiler 'MinGW64 Compiler (C)'.MEX configured to use 'MinGW64 Compiler (C)' for C language compilation.
If MATLAB is not able to find "gcc.exe", it is possible that MinGW is not installed correctly. You can reinstall MinGW again and check if it resolves the issue. Also, make sure that the MinGW version you are using is 4.9.2. I hope this helps!
Below are answers to some common questions when installing the MinGW-w64 compiler.
1. How do I install the MinGW-w64 compiler?
You can install MinGW-w64 compiler in two ways:
- In MATLAB, on the "Home" tab, click Add-Ons. In the pop-up window, search for the term "mingw" then click "MATLAB Support for MinGW-w64 C/C++ Compiler". Choose the install option and follow the steps for installation.
- On MathWorks "File Exchange" search for the term "mingw" and select "MATLAB Support for MinGW-w64 C/C++ Compiler". Click the download button. This downloads a "mingw.mlpkginstall" file. Double click this file and follow the steps for installation.
2. I already have MinGW-w64 on my computer. How do I configure it to work with MATLAB?
3. I am already using MinGW-w64 compiler with one release of MATLAB, can I use the same compiler with another MATLAB release?
Yes, you can use the MinGW-w64 compiler installed for one release of MATLAB with another release of MATLAB. However, there are the following caveats:
- Make sure that the MinGW-w64 compiler version that you are using with the current MATLAB release is also the supported version for the other MATLAB release. To check this, refer to the Supported Compilers Page: https://www.mathworks.com/support/compilers
- If the MinGW-w64 compiler version you are using is also supported for the other MATLAB release, then see "Manually Configure MinGW for MATLAB" here. You can get the location of your MinGW-w64 compiler by running the MATLAB command
>> getenv MW_MINGW64_LOC
3. If the MinGW-w64 compiler version that you are using is not supported for the other MATLAB release, use Add-Ons to get the compiler.
4. Is MinGW-w64 supported for all platforms?
MinGW-w64 is a Windows-only compiler. Please see the Supported Compilers page for more details: https://www.mathworks.com/support/compilers
5. Is MinGW-w64 supported for all MathWorks products?
6. What versions of MATLAB support MinGW-w64?
MinGW-w64 compiler is supported for MATLAB releases R2015b and later.
7. Is MinGW-w64 compiler supported with MathWorks MATLAB Compiler SDK deployment products?
For the list of products supported with MinGW compiler refer to the Supported Compilers Page for your MATLAB release.
8. Why do I see the error “Download Failed: Server returned HTTP response code: 503”?
The third-party tools used in the MinGW-w64 Support Package are downloaded from an external website. If this external site experiences problems, then MATLAB is unable to install the Support Package. Try re-installing MinGW-w64 with the current Support Package.
9. I do not have access to the internet on my machine. Can I still install the MinGW-w64 Add-On?
For MATLAB R2015b and R2016a, see:
For R2016b and later:
On a computer that has MATLAB installed and has internet access, follow the steps below:
- In MATLAB go to the Home Tab and click on "Add-Ons".
- In the Add-ons explorer window, search for the term "mingw".
- Click on the submission "MATLAB Support for MinGW-w64 C/C++ Compiler"
- Click on the drop-down arrow on the "Install" button and select the option "Download Only" as shown in the screenshot below.
- Copy all the artifacts to a USB drive and move these to a computer that you want to install MinGW on (the computer without internet).
On the computer that has MATLAB installed and does not have internet access, follow the steps below:
- Put the downloaded contents of the USB drive in a folder on your computer.
- The downloaded artifacts contain a "readme.txt" file, which has instructions for installation of the Add-On on a particular platform.
- Follow the installation instructions for the Windows platform from the "readme.txt" file to install the Add-On.
10. Can the MinGW-w64 compiler obtained using the MinGW-w64 Add-On be used for compiling Fortran MEX files?
MinGW-w64 compiler is currently not supported for compilation of Fortran MEX files. See Supported Compilers Page.
Best Answer