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

8 次查看(过去 30 天)
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 个评论
Jan
Jan 2018-4-21
What exactly does this mean: "Then when I go to run my own mex function"?
Shrirang Bhadgaonkar
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.

请先登录,再进行评论。

回答(1 个)

Shrirang Bhadgaonkar
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')

类别

Help CenterFile Exchange 中查找有关 Troubleshooting in MATLAB Compiler SDK 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by