Unable to locate a C-compiler required by Stateflow and MATLAB Function blocks
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello, let me start by saying what I have installed:
- Matlab/Simulink 2013a - 64 bit
- Microsoft Visual C++ Compilers 2010 SP1 Standard - x64 and x86 (both installed)
- Microsoft Visual C++ 2010 Redistributable - 10.0.40219, x64 and x86 (both installed)
- Microsoft Windows SDK 7.1
- Microsoft .NET Framework 4 and 4.5.2
- Windows 7
I work for a company that requires that I use these exact versions of software for compatibility issues so please don't recommend that I get "newer versions" of any of these pieces of software.
Here's what I'm trying to do
- Setup the compiler as follows:
- Open Matlab
- enter 'mex -setup'
- choose my compiler
- check the results of setting the compiler using 'mex.getCompilerConfigurations()'
Here's the code and output from this:
>> mex -setup
Welcome to mex -setup. This utility will help you set up
a default compiler. For a list of supported compilers, see
http://www.mathworks.com/support/compilers/R2013a/win64.html
Please choose your compiler for building MEX-files:
Would you like mex to locate installed compilers [y]/n? y
Select a compiler:
[1] Microsoft Software Development Kit (SDK) 7.1 in c:\Program Files (x86)\Microsoft Visual Studio 10.0
[0] None
Compiler: 1
Please verify your choices:
Compiler: Microsoft Software Development Kit (SDK) 7.1
Location: c:\Program Files (x86)\Microsoft Visual Studio 10.0
Are these correct [y]/n? y
***************************************************************************
Warning: MEX-files generated using Microsoft Windows Software Development
Kit (SDK) require that Microsoft Visual Studio 2010 run-time
libraries be available on the computer they are run on.
If you plan to redistribute your MEX-files to other MATLAB
users, be sure that they have the run-time libraries.
***************************************************************************
Trying to update options file: C:\Users\iw542d\AppData\Roaming\MathWorks\MATLAB\R2013a\mexopts.bat
From template: C:\PROGRA~1\MATLAB\R2013a\bin\win64\mexopts\mssdk71opts.bat
Done . . .
**************************************************************************
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. In the near future
you will be required to update your code to utilize the new
API. You can find more information about this at:
http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html
Building with the -largeArrayDims option enables the new API.
**************************************************************************
>> CC = mex.getCompilerConfigurations()
Reference to non-existent field 'The system cannot find the path specified.
VSINSTALLDIR'.
Error in mex.CompilerConfigurationFactory/determineLocation (line 281)
location = detailStruct.(outputValue);
Error in mex.CompilerConfigurationFactory/process (line 127)
basicStructArray(numberOfLangs).Location = determineLocation(obj,
storageLocations{index}, basicStructArray, detailsStruct);
Error in mex.getCompilerConfigurations (line 56)
compConfig = process(ccF);
>>
Next, I'm trying to build a Simulink model and I get the following error message
Unable to locate a C-compiler required by Stateflow and MATLAB Function blocks.
Use 'mex -setup' to select a supported C-compiler.
HOW DO I FIX THIS COMPILER ISSUE?
댓글 수: 0
답변 (1개)
Ryan Livingston
2015년 3월 18일
The error from mex.getCompilerConfigurations() states that VSINSTALLDIR cannot be found. In MATLAB run:
getenv VSINSTALLDIR
to see if you get a value for that variable. If not, I would:
1. Restart Windows to see if the SDK installation settings take hold after rebooting
2. Try to MEX a simple file. In a directory where you have write privileges:
copyfile(fullfile(matlabroot,'extern','examples','mex','yprime.c'),pwd)
mex -v yprime.c
Does that work? If not, that will need to be resolved first.
댓글 수: 2
Ryan Livingston
2015년 3월 19일
After restarting Windows, does the model now simulate?
There is also the related:
that gives a few troubleshooting steps.
참고 항목
카테고리
Help Center 및 File 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!