simulink编译出现'An_error_occurred_during_the_call_to_make''fatal error U1077: return code '0x2''

simulink编译出现'An_error_occurred_during_the_call_to_make''fatal error U1077: return code '0x2''_第1张图片

关键是这句:Cannot open include file: 'pm_printf.h':No such file or directory

网上找到一个类似错误,说要在指定目录下添加相应的h文件。用全局搜索找了一下,在D:\Program Files\MATLAB\R2018b\toolbox\physmod\common\foundation\core\c\win64路径下找到了pm_printf.h,然后拷贝到了指定路径D:\Program Files\MATLAB\R2018b\simulink\include。

再运行,编译成功。

https://nl.mathworks.com/matlabcentral/answers/121926-simulink-compability-r2011b-vs-r2012b

还有一个也是同类错误,但解决办法是修改代码生成配置,原答案如下。我试了一下,对我的问题没什么帮助,不过也贴上来做个参考吧。

https://nl.mathworks.com/matlabcentral/answers/109230-fatal-error-while-building-simulink-model-with-xpc-target-blocks

The error appears when we try to build using non-xPC target environment language compilers such as 'grt.tlc', 'ert.tlc' etc. In order to build successfully without errors, please go to Model Configuration Parameters -> Code Generation and choose 'xpctarget.tlc' from the browse list as the system target file. 

In case you want to still choose non-xPC target language compilers, the only workaround will be to remove the xPC target blocks from the model. 

 

注意,新版本里面已经没有xpctarget.tlc,改为了slrt.tlc。

  • In the Code Generation pane of the Configuration Parameters dialog box, the System target file setting xpctarget.tlc becomes slrt.tlc and xpctargetert.tlc becomes slrtert.tlc.

 

 

 

你可能感兴趣的:(matlab)