Using Visual Studio as C++ compiler for MEX files

75 ビュー (過去 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 Center および File ExchangeElectrophysiology についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by