MATLAB: Is the ‘rtlibsrc.h’ file not included in the current path of the generated code in Real-Time Workshop Embedded Coder

Embedded Coderfileheaderpackngopathsimulink

The generated code for my model contains the following line:
#include "rtlibsrc.h"
However, this file is not located in the same path as the generated code. When I compile the code outside of Real-Time Workshop Embedded Coder, I need to copy the file every time. I would like this file to be placed in the same path as the generated code.

Best Answer

The ability to automatically include the 'rtlibsrc.h' header file in the same path as the generated code is not available in Real-Time Workshop Embedded Coder.
To workaround this issue from R2006b onwards, please use the command 'packNGo' to pack all the generated files. Using this command will automatically pick the file 'rtlibsrc.h'.
For previous product releases, read below for any possible workarounds:
To work around this issue, manually copy $MATLABROOT\rtw\c\libsrc\rtlibsrc.h file to the same directory as the generated code, where $MATLABROOT is the MATLAB installation directory on your machine which can be obtained by typing
matlabroot
at the MATLAB Command prompt.