Why do I get an error while parsing custom code for my Simulink model?

Hi there,
I am trying to run a simulink model in which some C caller blocks are used ( external custom c code). The Model is legacy model but I am trying to run it on Matlab 2021b
The C comoiler is MinGW64 Compiler (C)
I already updated the model advisor befoer I try to RUN the model. I received the follwoing error:
Error while parsing custom code for model 'mymodel'. Fix the errors in your custom code or disable 'Import custom code' if your custom code has incompatibilities.
Caused by:
Component:Simulink | Category:Block diagram error
Advice and input very welcome, thanks!

6 件のコメント

Walter Roberson
Walter Roberson 2022 年 5 月 5 日
It looks to me as if MinGW is not recognizing _cdecl as a keyword. It is not part of C itself, it is a Microsoft extension (that is also implemented by several other companies for Microsoft compatibility.)
It looks to me as if there is a command line option that controls recognition of _cdecl
David Tong
David Tong 2022 年 5 月 5 日
Thanks Walter! Do you have any idea what is the command?
David Balbuena
David Balbuena 2022 年 5 月 11 日
Is this error specific to your custom code? You could try an example model to make sure this isn't some compiler configuration issue.
David Tong
David Tong 2022 年 5 月 11 日
Thanks David for your input, Actually I did try the example you listed above and valid it in the Configruration Parameters, The functions ( Custom code ) are imported and built successfully.
I am not sure how the errors be specific to my custom code since all the errors point to MinGW?
David Balbuena
David Balbuena 2022 年 5 月 12 日
It could be an issue with the code parser. Are you able to share your code? I'd recommend contacting technical support, just in case this is a bug: https://www.mathworks.com/support/contact_us.html
Vincent Massart
Vincent Massart 2023 年 1 月 18 日
編集済み: Vincent Massart 2023 年 1 月 18 日
We have a very similar problem with R2018b and C Caller
all work on my colleague machine and not anymore on mine....
In line 12 of c:\xxxxxxxxxx\xxxxxxxxxxxxxxxxxxxx\xxxx_fpga_raw_convert.h, expected a ";": | typedef struct __attribute__ ((packed)) function_name {

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSystem Composer についてさらに検索

タグ

質問済み:

2022 年 5 月 5 日

編集済み:

2023 年 1 月 18 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by