Keil 编译IEC61131-3库,头文件,大量出现以下错误;
cast to type ? is not allowed
compiling resource1.c...
..\PLC\rts\matiec\lib\C\iec_std_functions.h(192): error: #119: cast to type "TIME" is not allowed
__ANY_BIT(__iec_)
..\PLC\rts\matiec\lib\C\iec_std_functions.h(192): error: #119: cast to type "TIME" is not allowed
__ANY_BIT(__iec_)
..\PLC\rts\matiec\lib\C\iec_std_functions.h(196): error: #119: cast to type "DATE" is not allowed
__ANY_BIT(__to_anydate_)
..\PLC\rts\matiec\lib\C\iec_std_functions.h(196): error: #119: cast to type "TOD" is not allowed
__ANY_BIT(__to_anydate_)
..\PLC\rts\matiec\lib\C\iec_std_functions.h(196): error: #119: cast to type "DT" is not allowed
__ANY_BIT(__to_anydate_)
..\PLC\rts\matiec\lib\C\iec_std_functions.h(196): error: #119: cast to type "DATE" is not allowed
通过如下方式解决:

--gnu -Dlittle_endian
C99 Mode
在使用Keil编译IEC61131-3标准库时遇到了关于casttotype的错误,如casttotypeTIMEisnotallowed等,这通常涉及到类型转换不被编译器接受。文章提出了通过添加编译选项--gnu-Dlittle_endian和C99Mode来尝试解决这些问题。

被折叠的 条评论
为什么被折叠?



