MATLAB: How to stop the error regarding rt_EnableState() in the generated code in Real-Time Workshop 6.4 (R2006a)

rt_enablestatesimulink coder

I am generating code from a model. The model contains an Enabled Subsystem, which in turn contains a Switch-Case block. The generated code contains a call to the function rt_EnableState(). However, when I try to build the code in an external application, the function is undefined.

Best Answer

The function rt_EnableState() is defined in rt_enab.c. This file is located in:
$MATLABROOT\rtw\c\libsrc
where $MATLABROOT is the MATLAB root directory on your machine, as returned by typing:
matlabroot
at the MATLAB Command Prompt.
Including this directory in your external build should resolve the error. For more information on directories to include, see the documentation on Cross-Compiling Code Generated on Windows, available online at:
<http://www.mathworks.com/access/helpdesk/help/toolbox/rtw/ug/bqobjt8.html#bqghet6>