When building a C++ program using MATLAB Engine in Visual Studio, is it possible to specify -R2017b?

4 次查看(过去 30 天)
I have set up Micosoft Visual Studio 2022 to build Matlab Engine applications. But it looks like by default is compiling for -R2018a instead of -2017b (which is the default option in the Matlab compiler). And that's making the Visual Studio compiler to throw LNK2019 and LNK1120 errors (unvresolved externals). Any idea on how to solve this problem?

回答(2 个)

Benjamin Thompson
Benjamin Thompson 2024-1-21
It seems like it should be possible, provided you can install Visual Studio 2017 Professional or Enterprise Edition:
Since Visual Studio 2022 was released much later than the final release of MATLAB R2017B, there is probably no way to make the two work together.
  1 个评论
Mohamed Lanjri El Halimi
Thanks for the quick answer!
On the note 2 of https://www.mathworks.com/support/requirements/supported-compilers.html is stated that Visual comunity, Professional and Enterprise edidtions are supported.
Also the Visual Studio installer allows install older versions of it's compiler.
The code that I was trying to compile supports conditional compiling for various Matlab versions, finally figured out that just needed set up correctly the preprocessor definitions.
There's a pretty convinient Visual Studio extension that provides templates for creating Mex functions, which facilitates a lot to build the final solution.

请先登录,再进行评论。


Mohamed Lanjri El Halimi
The code that I was trying to compile supports conditional compiling for various Matlab versions, finally figured out that just needed set up correctly the preprocessor definitions.
There's a pretty convinient Visual Studio extension that provides templates for creating Mex functions, which facilitates a lot to build the final solution.

类别

Help CenterFile Exchange 中查找有关 Call MATLAB from C 的更多信息

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by