Why does't MATLAB R2016b recognize a C Compiler?

3 次查看(过去 30 天)
I know this Question has already been asked several times but I still don't manage to solve it. I run Matlab R2016b on Windows 10.
Everytime I compile a SimuLink Program I get the following error message :
"An installed compiler was not detected. Certain simulation modes, as well as host-based coder builds require that a compiler be installed. Please install one of the supported compilers for this release as listed at:
MATLAB must be restarted after the compiler is installed.
Once you have a supported compiler installed, either select it to be the MEX compiler or override the MEX compiler with: slrtsetCC -setup"
Here is what I did:
- I installed Microsoft Visual Studio Professional 2015 and have now
- Microsoft Visual C++ 2015 and also
- Microsoft .NET Framework 4.6.1 SDK on my System (both are listed in the above link).
- When I run slrtsetCC -setup in the MATLAB Command Window, I get the following:
Select your compiler for Simulink Real-Time.
[1] Microsoft Visual C++ Compilers Professional 2015 in C:\Program Files >>(x86)\Microsoft Visual Studio 14.0
[0] None
Compiler:1
Verify your selection:
Compiler: Microsoft Visual C++ Compilers Professional 2015
Location: C:\Program Files (x86)\Microsoft Visual Studio 14.0
Are these correct [y]/n?y
Done...
Where I selected Compiler: 1 and verified ( y ).
- When I now try compiling my Program, I still get the same error message that there is no Compiler detected (restarting MATLAB doesn't change that).
- What could also be helpful to answer my question:
When I type myCCompiler = mex.getCompilerConfigurations('C','Selected'), I get
myCCompiler =
0×1 CompilerConfiguration array with properties:
Name
Manufacturer
Language
Version
Location
ShortName
Priority
Details
LinkerName
LinkerVersion
MexOpt
Here I should be able to see the properties of the selected C Compiler, but it doesn't show anything.
When I type mex -setup, I get
Error using mex
No supported compiler or SDK was found. You can install the freely available MinGW-w64 C/C++ compiler; see Install
MinGW-w64 Compiler. For more options, visit http://www.mathworks.com/support/compilers/R2016b/win64.html.
Which is the same link as before..

采纳的回答

Kushagr Gupta
Kushagr Gupta 2017-3-15
There could be a possibility that while installing Visual Studio, "Typical" setup option was chosen, which does not install the Visual C/C++ compiler by default. This is seen in Microsoft's documentation:
To resolve this issue, re-run the Visual Studio 2015 installer again and choose to perform a "Custom" setup. Then during installation, make sure to enable "Visual C++" under "Programming Languages".
Also, the function 'slrtsetCC' is for the Simulink Real-Time product which is independent of Simulink/Enbedded Coder products.
Moreover, the verbose mode for "mex -setup" will be helpful in order to see what is going on under the hood. This can be done by including the -v flag, shown as follows:
>> mex -v -setup
  1 个评论
Ilian Jaeger
Ilian Jaeger 2017-3-15
Thank you very much for your answer, this was indeed the problem. The thing is that I recently realized that i need VS2013 because the 2015 Version unfortunately doesn't work for Simulink Real Time Applications. So I installed the 2013 Version and then I had the same problem again. Again, I restarted the 2013 Installer, but even though I enabled every option it still doesn't work. (same error message)
Doesn't VS2013 provide VisualC++ ? Should I install both version of Visual Studio?

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by