Error using mex No supported compiler or SDK was found.

4 visualizzazioni (ultimi 30 giorni)
Hello All,
I've just installed Microsoft Visual Studio Professional 2013, and Matlab R2014a on my laptop, but when I use the command mex -startup or mex -v arrayProduct.c, I get the following error message:
Error using mex No supported compiler or SDK was found. For options, visit http://www.mathworks.com/support/compilers/R2014a/win64.
Can anybody tell what the cause of this error is or how I can link the mex compiler with visual studio 2013?
Thanks alot.
  4 Commenti
Friedrich
Friedrich il 11 Lug 2014
It seems like the environment variable VS120COMNTOOLS wasnt created during the installation of VS 2013. Either create it manually or reinstall VS 2013. The VS120COMNTOOLS environment variable should point to the Common7\Tools subfolder of your Visual Studio installation, e.g.
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\
margol
margol il 12 Lug 2014
Thanks. I checked it, and it was set to the above path.

Accedi per commentare.

Risposte (1)

Nidhi Jain
Nidhi Jain il 14 Lug 2014
Hi,
What do you mean by “linking the MEX compiler with Visual Studio”. What is your workflow?
If you are trying to create a MEX file using Microsoft Visual Studio then you can follow these steps:
1. Create a 'Project' in Visual Studio. In the resulting window, click 'Next'.
2. Make sure that the platform is selected to be ‘x64’ since you want to create ‘.mexw64’, or you change it to win32 if you want to create ‘mexw32’
3. In the 'Application Settings' window select 'Application Type' to be 'DLL' and check the box next to 'Empty project'. Click 'Finish'.
4. In the resulting project's Solution Explorer, right click on 'Source Files' and choose 'Add' -> 'Existing Item'. Choose 'fileName.c' from the folder where it is located.
5. Right click on the project name, choose 'Add' -> 'New Item' -> Code -> 'Module Definition File'. After creating it, paste the following lines:
LIBRARY MYFILE
EXPORTS mexFunction
And click “Ctrl+S”. The file will get saved as “Source.def”
6. Go to the project properties from 'Project' -> '<projectname> Properties' and set the following:
a. Go to 'C\C++' -> 'General'. Set 'Additional Include Directories' to '<matlabroot>\extern\include'.
b. Go to 'C\C++' -> 'Preprocessor'. Add the following to 'Preprocessor Definitions': 'MATLAB_MEX_FILE'.
Do not delete any of the existing content in the preprocessor definition field. c. Go to ‘C\C++’ -> ‘Precompiled Header’. Select ‘Not using precompiled header’ for ‘Precompiled Header’.
d. Go to 'Linker' -> 'General'. Change 'Output File' to '$(OutDir)\$(ProjectName).mexw64'. Also, under the same tab, set 'Additional Library Directories' to '<matlabroot>\extern\lib\win64\microsoft'.
e. Go to 'Linker' -> 'Input'. Set 'Additional Dependencies' to 'libmx.lib libmex.lib libmat.lib' (withoout quotes and each on different line). Also, ensure that the module definition file ‘Source.def’ that you created in step 4 has been selected under 'Module Definition File'.
f. Click 'Apply' -> 'Ok' to close the project properties.
7. Build the solution. Change the current MATLAB directory to the directory in which the MEX file was created.
8. Run the MEX file using the following command: <mexfilename>(inputs)
Also, if you want to MEX a C file, you can do so using MATLAB in just 1 line
>> mex filename.c

Categorie

Scopri di più su Troubleshooting in MATLAB Compiler SDK in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by