MATLAB: How to fix rtwtypes.h error

powertrainrtwtypessimulink

When running the model Electrci vehcicle reference application model from powertrain blockset, cant able to get result expect these errors. Can anyo one please help me put of this.
### Build procedure for model: 'BattEv' aborted due to an error.
C:/PROGRA~1/Polyspace/R2019b\sys\lcc64\lcc64\bin\lcc64 -c -FoBattEv.obj -nodeclspec -c -DMATLAB_MEX_FILE -DMODEL=BattEv -DNUMST=1 -DNCSTATES=1 -DMAT_FILE=0 -DINTEGER_CODE=0 -DONESTEPFCN=0 -DTERMFCN=1 -DHAVESTDIO -DMULTI_INSTANCE_CODE=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DMDL_REF_SIM_TGT=1 -DENABLE_SLEXEC_SSBRIDGE=1 -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -I. -I../../.. -IC:/Users/MATLAB/Projects/examples/EV4/main/Work -IC:/Users/MATLAB/Projects/examples/EV4/main/Work/slprj/sim/BattEv -IC:/PROGRA~1/Polyspace/R2019b/extern/include -IC:/PROGRA~1/Polyspace/R2019b/simulink/include -IC:/PROGRA~1/Polyspace/R2019b/rtw/c/src -IC:/PROGRA~1/Polyspace/R2019b/rtw/c/src/ext_mode/common -IC:/PROGRA~1/Polyspace/R2019b/rtw/c/ert -IC:/Users/MATLAB/Projects/examples/EV4/main/Work/slprj/sim/_sharedutils -IC:/PROGRA~1/Polyspace/R2019b\sys\lcc64\lcc64\include64 -w -noregistrylookup -dll -Zp8 -noregistrylookup -DLCC_WIN64 BattEv.c cpp: c:/progra~1/polyspace/r2019b/rtw/c/src\rtw_modelmap.h:30 "c:\users\matlab\projects\examples\ev4\main\work\slprj\sim\battev\battev.h":6 "c:\users\matlab\projects\examples\ev4\main\work\slprj\sim\battev\battev_capi.h":4 battev.c:2 Could not find include file "rtwtypes.h" cpp: c:/progra~1/polyspace/r2019b/rtw/c/src\rtw_capi.h:22 c:/progra~1/polyspace/r2019b/rtw/c/src\rtw_modelmap.h:42 "c:\users\matlab\projects\examples\ev4\main\work\slprj\sim\battev\battev.h":6 "c:\users\matlab\projects\examples\ev4\main\work\slprj\sim\battev\battev_capi.h":4 battev.c:2 Could not find include file "rtwtypes.h"
Error(s) encountered while building "BattEvlib"
Component:Simulink | Category:Model error
Error while bringing model references of model EvReferenceApplication up to date: see errors reported above for details.
Component:Simulink | Category:Model error

Best Answer

I got this error resolved after going through followed steps:
First, i checked for mex -setup which shows no compiler installed then i installed the WinGW C,C++ compiler using add on feature which mainly closed the error of compiling issue with rtwtypes.h files and other syntax error.
At this point, the error left with: gmake matlab failed with error of -2
this i resolved with the help of this answer, as my laptop not supporting the method 1,2 so i went with third method reinstalled matlab in a separate folder which name doesnot contains any spaces.
Now, the error of -2 was resolved but came up with new error stating failed to generate all binary outputs and not to read c:/users/account name(this account name has spaces in it and shows half name in the error).
I understand that matlab is not able to read my entire user account name in pc bcoz it having spaces in it. So, thought of renaming the existed user account name but after going through the reviews it states that renaming the user account name forcefully which windows10 doesnt allow will create problems in long run. Then i created a new user account in my pc with no spaces in its user name.
After this i loggined in the new user account, the run that model in simulink in new user account and finally it runned well without any errors.
Thus, finally i resolved the issue. Thanks for the staff who wrote a detailed answer in the above provided link which helped me a lot and to @Chirag who responeded in such a quick time.
Related Question