how to enable mex detect the C/C++ compiler (integrated in Visual Studio 2022) on older MATLAB (R2018b) ?
Show older comments
My matlab version is 2018b, and visual studio version is 2022.
I want matlab to detect the compiler integrated in the visual studio
(path:Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\bin\Hostx64\x64\cl.exe)
I tried to copy and modify the associated xml file, however, I found for the newest matlab, it is only support the oneAPI.
I don't know how to modify the xml file, and I have not found something similar to solve this problem.
EDIT: I (Bruno) wrongly edit the question, sorry
5 Comments
Bruno Luong
on 1 Oct 2024
Edited: Bruno Luong
on 1 Oct 2024
"However, I found that for the newest matlab, it only supports the oneAPI as showned in intel_c_24_vs2022.xml."
That is not normal MATLAB always support MSVS compiler for mex AFAIK https://www.mathworks.com/support/requirements/supported-compilers.html
It cannot support OneAPI 2022 on R2018. Your observation of the rellease dates do not make sense to me, I shouldn't have any compiler post 2018 supported by R2018b. You probably working with a strange MATLAB installation.
What returns this command in your case
ver
dir([matlabroot '\bin\win64\mexopts\msvc*.xml'])
Biyi Wang
on 1 Oct 2024
Bruno Luong
on 1 Oct 2024
Edited: Bruno Luong
on 1 Oct 2024
So you should start with msvc2017.xml or msvcpp2017.xml then modify it (and NOT with intel_c_24_vs2022.xml that is for Intel 2024 OneAPI compiler integrated to 2022 MSVS user interface)
The newer MATLAB version should have these files msvc2022.xml msvcpp2022.xml for MSVS 2022 compiler, but I'm not sure about backward compatibility with MATLAB older version R2018b. You could try to copy it to [matlabroot '\bin\win64\mexopts\'] and see.
Bruno Luong
on 2 Oct 2024
Good to see it helps.
Answers (1)
Walter Roberson
on 1 Oct 2024
0 votes
My matlab version is 2018b, and visual studio version is 2022.
MATLAB R2018b has no support for VS 2018 or later.
Categories
Find more on Write C Functions Callable from MATLAB (MEX Files) in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!