Using Visual Studio as C++ compiler for MEX files

139 vues (au cours des 30 derniers jours)
Scott Harris
Scott Harris le 17 Juil 2019
Commenté : Ainan Asif le 2 Fév 2022
I'm trying to use the following tool with MATLAB 2019a on Windows 10: https://github.com/MouseLand/Kilosort2
The installation instructions say to use Visual Studio 2013 to compile mex files and I've installed the parallel computing and signal processing toolboxes along with CUDA 10.0.
I've tried using
mex -setup
and
mex -setup c++
to set VS 2013 as the compiler, but MATLAB can't seem to find it and returns the following error
% Error using mex
% No supported compiler was found. You can install the freely available MinGW-w64 C/C++ compiler; see Install
% MinGW-w64 Compiler. For more options, visit https://www.mathworks.com/support/compilers.
Now I have found documentation here https://www.mathworks.com/support/requirements/previous-releases.html that indicates that VS2013 isn't a supported compiler in MATLAB 2019a - or any other recent version - but I know this tool is very popular within neuroscience and no one on the github page linked above seems to have had any problems establishing VS2013 as the compiler.
Any ideas are welcome and I appreciate the help.
Edit: I am using "Visual Studio Community 2013 with Update 5", but the authors of the github page indicate that this is permissable as they recommend VS because it is free (only the Community version is free)

Réponses (3)

asaf benjamin
asaf benjamin le 15 Jan 2020
I had the exact same problem using MATLAB 2019b on Windows 10. Notice that running
mex -setup -v
shows that Matlab isn't looking for VS 2013, only 2015 and later. I downloaded and installed MSVS 2015 Community for free, used a custom instalation with all the C++ components included, and then ran
mex -setup
and set the C and C++ compiler to VS 2015. After that it worked like a charm. Hopes this help others...
  2 commentaires
Stefan Oline
Stefan Oline le 10 Août 2020
I just want to thank you for documenting this solution. I've been running in circles following the KiloSort2 installation instructions. Using 2013 and 2019 both failed but 2015 did work for me (even though MATLAB complained while executing mexGPUall.m). +1
Ainan Asif
Ainan Asif le 2 Fév 2022
How did you set C compiler to VS? Can you tell me the whole process?

Connectez-vous pour commenter.


Subhadeep Koley
Subhadeep Koley le 2 Août 2019
MinGW is one of the supported compilers in MATLAB R2019a for mex file compilation according to the documentation.
Download MinGW free of charge from here.

Torben Ott
Torben Ott le 4 Déc 2020
Thanks for bringing this up! Same issue for me with MATLAB R2019b trying to install kilosort2. Installing VS2015 Community instead of VS2013 recommended in the readme solved it (choose VS2015 as your compiler in MATLAB with mex -setup). When installing VS2015 select Programming Languages -> C++.

Catégories

En savoir plus sur Introduction to Installation and Licensing dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by