Using Visual Studio as C++ compiler for MEX files

조회 수: 74 (최근 30일)
Scott Harris
Scott Harris 2019년 7월 17일
댓글: Ainan Asif 2022년 2월 2일
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)

답변 (3개)

asaf benjamin
asaf benjamin 2020년 1월 15일
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
Stefan Oline
Stefan Oline 2020년 8월 10일
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 2022년 2월 2일
How did you set C compiler to VS? Can you tell me the whole process?

댓글을 달려면 로그인하십시오.


Subhadeep Koley
Subhadeep Koley 2019년 8월 2일
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 2020년 12월 4일
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++.

카테고리

Help CenterFile Exchange에서 Electrophysiology에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by