Simulink Coder not making executable

조회 수: 19 (최근 30일)
Andri Egilsson
Andri Egilsson 2023년 2월 9일
댓글: Andri Egilsson 2023년 2월 16일
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