MATLAB: Do I receive an error regarding incompatible types when building the model in Real-Time Workshop 5.1 (R13SP1)

atomiccodecompileerrorifincompatiblerealrtwsimulink codersubsystemsystemtimetypesworkshop

When I build my model files, I receive the following error during the compile stage of the build process:
### Compiling NewMotorFish.c
cl -Ot /c /O2 /Ot /nologo
W0 -DMODEL=NewMotorFish -DRT -DNUMST=2 -DTID01EQ=1 -DNCSTATES=51 -DMT=0 -
DHAVESTDIO -DXPCMSVISUALC -DXPCCALLCONV= NewMotorFish.c
NewMotorFish.c
NewMotorFish.c(7374) : error C2115: 'function' : incompatible types
NMAKE : fatal error U1077: 'cl' : return code '0x2'
Stop.

Best Answer

This bug has been fixed for Release 14 SP1 (R14SP1). For previous releases, please read below for any possible workarounds:
This has been verified as a bug in Real-Time Workshop 5.1 (R13SP1) in the way that code is generated from atomic subsystems. Currently, to work around this issue, try the following:
1) Right-click on the subsystem(s) whose generated code is producing an error and select "Subsystem parameters ..."
2) Check "Treat as atomic unit"
3) Change the "RTW system code" property from Auto to Function.
4) After the changes have been made, rebuild the model.