mex and the Visual Studio Community 2022 C/C++ compiler

112 visualizaciones (últimos 30 días)
Bogdan Udrea
Bogdan Udrea el 2 de Mzo. de 2022
Comentada: Walter Roberson el 3 de Nov. de 2022
Dear Colleagues,
I have recently installed Visual Studio Community 2022 because the C/C++ compiler is required by Quanser/QUARC. The default installation is not compatible with MATLAB mex so the
>>mex -setup
command returns an error.
After a bit of trial an error I have found that selection of the MSVC v140 - VS 2015 C++ build tools installs the 2015 version of the compiler that is compatibe with mex. Consequwntly, I can set it up mex and I am able to run the Quanser QUARC demos.Please see below the screenshot obtained from the Modify option of the VS Community 2022 installer app.
After this installation I get
>> mex -setup
MEX configured to use 'Microsoft Visual C++ 2015 (C)' for C language compilation.
I am writing to ask if anyone has a experience with the VS Community C/C++ compilers in general and if anything else is needed from this option list. I will update this thread if I find missing options.
Thank you.
BU
  6 comentarios
Lokeshwaran Manohar
Lokeshwaran Manohar el 3 de Nov. de 2022
Hello Muhammad,
Follow this link https://de.mathworks.com/matlabcentral/answers/443349-how-do-i-install-visual-studio-for-use-with-matlab-simulink#:~:text=Note%20that%20the%20Community%20(free,for%20use%20with%20MATLAB%2FSimulink. I downloaded VS2019 and installed with the above instructions. It's working for me. Also the MinGW compiler is working too.
Walter Roberson
Walter Roberson el 3 de Nov. de 2022
Could you confirm that you are using R2021b ? According to https://www.mathworks.com/support/requirements/previous-releases.html the VS2015 family was not supported for anything in R2021b -- you would have needed VS 2017 or VS 2019 or MinGW or one of the Intel compilers.
Remember to use
mex -setup C++
to set up the C++ compiler -- and remember that when it says VS 2017C++ then that is the C++ compiler, not the C compiler.

Iniciar sesión para comentar.

Respuestas (0)

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by