Simulink Coder not making executable

20 次查看(过去 30 天)
Hi,
I'm trying to make turn a model into executable C code but I'm not getting a executable file.
In the Matlab Command Window I have tried the following
mex -setup
MEX configured to use 'Microsoft Visual C++ 2019 (C)' for C language compilation.
To choose a different C compiler, select one from the following:
MinGW64 Compiler (C) mex -setup:C:\MathWorks\MATLAB\R2022a\bin\win64\mexopts\mingw64.xml C
Microsoft Visual C++ 2019 (C) mex -setup:C:\xx\xx\AppData\Roaming\MathWorks\MATLAB\R2022a\mex_C_win64.xml C
To choose a different language, select one from the following:
mex -setup C++
mex -setup FORTRAN
>> mex -setup:C:\MathWorks\MATLAB\R2022a\bin\win64\mexopts\mingw64.xml C
Renamed options file 'C:\xx\xx\AppData\Roaming\MathWorks\MATLAB\R2022a\mex_C_win64.xml' to 'C:\xx\xx\AppData\Roaming\MathWorks\MATLAB\R2022a\mex_C_win64_backup.xml'.
MEX configured to use 'MinGW64 Compiler (C)' for C language compilation.
I have the following settings in Simulink coder
The code builds and creates a folder but that folder only has the c and h files but no msvc folder with the executable or Visual Studio Solution.
Any ideas how to resolve this issue?
I have tried following the guide at Generate C Code from Simulink Model - MATLAB & Simulink - MathWorks Nordic to no avail.

回答(1 个)

Suman
Suman 2023-2-13
Hi Andri,
To generate an executable in Simulink Coder, you have to configure some of the parameters as follows:
  1. The parameter "Code Generation" -> "Generate code only" must be unchecked which is already done in your case.
  2. The parameter "Code Generation" -> "Build process" -> "Makefile configuration" -> "Generate makefile" must be checked.
If you cannot find the "Generate makefile" option, just open the Configuration parameters and search for it in the search window located on top.
If the "Generate makefile" option is unchecked, no makefile will be generated and the compiler will not have any instructions to build the executable, hence no executable is generated.
I hope this information is helpful to you.
Cheers,
Suman
  1 个评论
Andri Egilsson
Andri Egilsson 2023-2-16
Hi Suman,
I have un-checked the Generate code only option and checked the Generate makefile as recomended but when I generate the code I still do not get a msvc folder or a executable / visual studio solution.
I have tried to re-install matlab to see if that would fix this issue but I'm still a bit stuck.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

标签

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by