Simulink Coder not making executable

20 vues (au cours des 30 derniers jours)
Andri Egilsson
Andri Egilsson le 9 Fév 2023
Commenté : Andri Egilsson le 16 Fév 2023
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.

Réponses (1)

Suman
Suman le 13 Fév 2023
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 commentaire
Andri Egilsson
Andri Egilsson le 16 Fév 2023
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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Simulink Coder dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by