Why does the mex command work for the example, but not for my code?

I am using R2015b. I installed MinGW using the add on explorer and tried out the example shown here: https://www.mathworks.com/help/matlab/ref/mex.html. After running the mex function, I get an output saying:"Building with 'MinGW64 Compiler (C)'. MEX completed successfully"
Then when I go to run my own mex function, I get an error: "Error using mex No supported compiler or SDK was found. You can install the freely available MinGW-w64 C/C++ compiler;"
This does not make sense to me, as I clearly have the MinGW compiler already installed and mex working correctly in other places. Why can't it find the compiler I have installed in this instance but not the other?

3 commentaires

I'm having the same problem in R2017b.
What exactly does this mean: "Then when I go to run my own mex function"?
I am also facing the same issue. I can see MinGw64 as installed in Add-On Explorer but when I type mex -setup , Matlab does not lists MinGw64 in it. Please help. Thanks in advance.

Connectez-vous pour commenter.

Réponses (1)

I found the solution to my problem. Check if it is also applicable to you. I found out that after enetering following command "mex -v -setup C", Matlab was skipping MinGW64 installaion because environmental variable"MW_MINGW64_LOC" was not SET. I had reinstalled the MinGw64 but still this vaiable was not on the ENV path. To set this variable in path I used the command and everything went fine. Happy Ending !!! please check the support package installation path. (Note : This is not Good Practice)
setenv('MW_MINGW64_LOC','C:\ProgramData\MATLAB\SupportPackages\R2017b\3P.instrset\mingw_w64.instrset')

Catégories

En savoir plus sur Troubleshooting in MATLAB Compiler SDK dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by