Why does't MATLAB R2016b recognize a C Compiler?

3 views (last 30 days)
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..

Accepted Answer

Kushagr Gupta
Kushagr Gupta on 15 Mar 2017
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 Comment
Ilian Jaeger
Ilian Jaeger on 15 Mar 2017
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?

Sign in to comment.

More Answers (0)

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!