MinGW-w64 compiler not detected

22 views (last 30 days)
Dear all. When I try to compile the example script "timestwo.F" by entering "mex -R2018a timestwo.F", I obtain the error message "Supported compiler not detected." This simple example is provided by https://de.mathworks.com/help/matlab/matlab_external/build-fortran-mex-file.html.
I work on MATLAB R2023a and installed and implemented MinGW-w62, which should work for FORTRAN, too. My PATH includes C:\WINDOWS and C:\WINDOWS\System32 and C:\WINDOWS\System32\wbem. However, the request "mex.getCompilerConfigurations().Language" gives me only C and C++ as an answer. Looks like a stupid error from my side.
Thanks a lot for your support, Juergen.

Accepted Answer

Hassaan
Hassaan on 24 Jan 2024
  1. Check Compatible Compilers: First, ensure that you have a Fortran compiler that is compatible with MATLAB R2023a. You can find a list of supported compilers for each MATLAB version on the MathWorks website.
  2. Install a Compatible Fortran Compiler: If you don't have a compatible Fortran compiler installed, you will need to install one. Common choices for Fortran compilers that work with MATLAB include Intel Fortran Compiler and GFortran (part of GCC, but you might need a specific version).
  3. Configure the Compiler with MATLAB: Once the compatible compiler is installed, you need to configure it with MATLAB. You can use the mex -setup FORTRAN command in MATLAB to configure the Fortran compiler.
  4. Update System Path: Ensure that the path to the Fortran compiler binaries is added to your system's PATH environment variable. This step is crucial for MATLAB to locate the compiler.
  5. Verify Compiler Configuration: After setting up the compiler, run mex.getCompilerConfigurations('FORTRAN') in MATLAB to verify that MATLAB recognizes the Fortran compiler.
  6. Try Compiling Again: Once the Fortran compiler is set up correctly, try compiling the timestwo.F script again using the mex -R2018a timestwo.F command.
If you continue to have issues, it might be helpful to consult MATLAB's documentation or support resources for additional guidance specific to Fortran compiler setup and troubleshooting.
-----------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
It's important to note that the advice and code are based on limited information and meant for educational purposes. Users should verify and adapt the code to their specific needs, ensuring compatibility and adherence to ethical standards.
Professional Interests
  • Technical Services and Consulting
  • Embedded Systems | Firmware Developement | Simulations
  • Electrical and Electronics Engineering
Feel free to contact me.
  1 Comment
Juergen Baldzuhn
Juergen Baldzuhn on 25 Jan 2024
Hallo Muhammad.
Thanks a lot for your detailed answer. Your support is highly appreciated,
Juergen.

Sign in to comment.

More Answers (0)

Categories

Find more on Fortran with MATLAB in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!