Search code examples
matlabsimulinkstateflow

MATLAB C/C++ code generation error


I'm trying to build my simple Stateflow/Simulink design into C/C++, but I get this error. I used code generation before, but I don't know for this design it shows errors. Does anybody know what is wrong? And here, is my model.

enter image description here


Solution

  • In the Model toolbar select Simulation->Model configuration parameters. You have not setted the Code replacement library (CRL) in the Code Generation->Interface pane. Set it to C89/C90, C99, etc.

    PS: If you want to use the code generation you must set a Fixed-step solver (with its Step time) in the Solver pane.