Why do I get an error while parsing custom code for my Simulink model?
Show older comments
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:
- In line 539 of C:\ProgramData\MATLAB\SupportPackages\R2021b\3P.instrset\mingw_w64.instrset\x86_64-w64-mingw32\include\_mingw.h, incomplete type is not allowed: | void __cdecl __debugbreak(void); | ^
- In line 539 of C:\ProgramData\MATLAB\SupportPackages\R2021b\3P.instrset\mingw_w64.instrset\x86_64-w64-mingw32\include\_mingw.h, expected a ";": | void __cdecl __debugbreak(void); | ^
- In line 540 of C:\ProgramData\MATLAB\SupportPackages\R2021b\3P.instrset\mingw_w64.instrset\x86_64-w64-mingw32\include\_mingw.h, expected a ")": | __MINGW_INTRIN_INLINE void __cdecl __debugbreak(void) | ^
- In line 540 of C:\ProgramData\MATLAB\SupportPackages\R2021b\3P.instrset\mingw_w64.instrset\x86_64-w64-mingw32\include\_mingw.h, expected a ";": | __MINGW_INTRIN_INLINE void __cdecl __debugbreak(void) | ^
- In line 18 of C:\ProgramData\MATLAB\SupportPackages\R2021b\3P.instrset\mingw_w64.instrset\x86_64-w64-mingw32\include\stddef.h, expected a ";": | _CRTIMP extern int *__cdecl _errno(void); | ^
- In line 20 of C:\ProgramData\MATLAB\SupportPackages\R2021b\3P.instrset\mingw_w64.instrset\x86_64-w64-mingw32\include\stddef.h, expected a ";": | errno_t __cdecl _set_errno(int _Value); | ^
- In line 21 of C:\ProgramData\MATLAB\SupportPackages\R2021b\3P.instrset\mingw_w64.instrset\x86_64-w64-mingw32\include\stddef.h, expected a ";": | errno_t __cdecl _get_errno(int *_Value); | ^
- In line 24 of C:\ProgramData\MATLAB\SupportPackages\R2021b\3P.instrset\mingw_w64.instrset\x86_64-w64-mingw32\include\stddef.h, expected a ";": | _CRTIMP extern unsigned long __cdecl __threadid(void); | ^
- In line 26 of C:\ProgramData\MATLAB\SupportPackages\R2021b\3P.instrset\mingw_w64.instrset\x86_64-w64-mingw32\include\stddef.h, expected a ";": | _CRTIMP extern uintptr_t __cdecl __threadhandle(void); | ^
- In line 428 of C:\ProgramData\MATLAB\SupportPackages\R2021b\3P.instrset\mingw_w64.instrset\lib\gcc\x86_64-w64-mingw32\6.3.0\include\stddef.h, expected a type specifier: | long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); | ^
- In line 428 of C:\ProgramData\MATLAB\SupportPackages\R2021b\3P.instrset\mingw_w64.instrset\lib\gcc\x86_64-w64-mingw32\6.3.0\include\stddef.h, a function type is not allowed here: | long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); | ^
- In line 429 of C:\ProgramData\MATLAB\SupportPackages\R2021b\3P.instrset\mingw_w64.instrset\lib\gcc\x86_64-w64-mingw32\6.3.0\include\stddef.h, expected a type specifier: | long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); | ^
- In line 429 of C:\ProgramData\MATLAB\SupportPackages\R2021b\3P.instrset\mingw_w64.instrset\lib\gcc\x86_64-w64-mingw32\6.3.0\include\stddef.h, a function type is not allowed here: | long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); | ^
Component:Simulink | Category:Block diagram error
Advice and input very welcome, thanks!
6 Comments
Walter Roberson
on 5 May 2022
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
on 5 May 2022
David Balbuena
on 11 May 2022
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
on 11 May 2022
David Balbuena
on 12 May 2022
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
on 18 Jan 2023
Edited: Vincent Massart
on 18 Jan 2023
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 {
Answers (0)
Categories
Find more on System Composer in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!