joeltackie
My plc LD complies just fine but when I try to complie and upload to openplc runtime v4 i keep getting the error below
 
 
 
 
 
 
 
 
 
[25-04-26 20:51:39]: In file included from core/generated/Res0.c:6:
[25-04-26 20:51:40]: core/generated/POUS.c: In function 'MAIN_body__':
[25-04-26 20:51:40]: core/generated/lib/iec_std_lib.h:94:31: error: expected identifier before '(' token
[25-04-26 20:51:40]: 94 | #define __lit(type,value,...) (type)value##__VA_ARGS__
[25-04-26 20:51:40]: | ^
[25-04-26 20:51:40]: core/generated/lib/iec_std_lib.h:96:35: note: in expansion of macro '__lit'
[25-04-26 20:51:40]: 96 | #define __literal(type,value,...) __lit(type,value,__VA_ARGS__)
[25-04-26 20:51:40]: | ^~~~~
[25-04-26 20:51:40]: core/generated/lib/iec_std_lib.h:98:31: note: in expansion of macro '__literal'
[25-04-26 20:51:40]: 98 | #define __BOOL_LITERAL(value) __literal(BOOL,value)
[25-04-26 20:51:40]: | ^~~~~~~~~
[25-04-26 20:51:40]: core/generated/POUS.c:211:28: note: in expansion of macro '__BOOL_LITERAL'
[25-04-26 20:51:40]: 211 | data__->TON0 = data__->__BOOL_LITERAL(FALSE);
[25-04-26 20:51:40]: | ^~~~~~~~~~~~~~
[25-04-26 20:51:40]: core/generated/lib/iec_std_lib.h:94:31: error: expected identifier before '(' token
[25-04-26 20:51:40]: 94 | #define __lit(type,value,...) (type)value##__VA_ARGS__
[25-04-26 20:51:40]: | ^
[25-04-26 20:51:40]: core/generated/lib/iec_std_lib.h:96:35: note: in expansion of macro '__lit'
[25-04-26 20:51:40]: 96 | #define __literal(type,value,...) __lit(type,value,__VA_ARGS__)
[25-04-26 20:51:40]: | ^~~~~
[25-04-26 20:51:40]: core/generated/lib/iec_std_lib.h:98:31: note: in expansion of macro '__literal'
[25-04-26 20:51:40]: 98 | #define __BOOL_LITERAL(value) __literal(BOOL,value)
[25-04-26 20:51:40]: | ^~~~~~~~~
[25-04-26 20:51:40]: core/generated/POUS.c:214:28: note: in expansion of macro '__BOOL_LITERAL'
[25-04-26 20:51:40]: 214 | data__->TON1 = data__->__BOOL_LITERAL(FALSE);
[25-04-26 20:51:40]: | ^~~~~~~~~~~~~~
[25-04-26 20:51:40]: core/generated/lib/iec_std_lib.h:94:31: error: expected identifier before '(' token
[25-04-26 20:51:40]: 94 | #define __lit(type,value,...) (type)value##__VA_ARGS__
[25-04-26 20:51:40]: | ^
[25-04-26 20:51:40]: core/generated/lib/iec_std_lib.h:96:35: note: in expansion of macro '__lit'
[25-04-26 20:51:40]: 96 | #define __literal(type,value,...) __lit(type,value,__VA_ARGS__)
[25-04-26 20:51:40]: | ^~~~~
[25-04-26 20:51:40]: core/generated/lib/iec_std_lib.h:98:31: note: in expansion of macro '__literal'
[25-04-26 20:51:40]: 98 | #define __BOOL_LITERAL(value) __literal(BOOL,value)
[25-04-26 20:51:40]: | ^~~~~~~~~
[25-04-26 20:51:40]: core/generated/POUS.c:217:28: note: in expansion of macro '__BOOL_LITERAL'
[25-04-26 20:51:40]: 217 | data__->TON2 = data__->__BOOL_LITERAL(FALSE);
[25-04-26 20:51:40]: | ^~~~~~~~~~~~~~
[25-04-26 20:51:40]: core/generated/lib/iec_std_lib.h:94:31: error: expected identifier before '(' token
[25-04-26 20:51:40]: 94 | #define __lit(type,value,...) (type)value##__VA_ARGS__
[25-04-26 20:51:40]: | ^
[25-04-26 20:51:40]: core/generated/lib/iec_std_lib.h:96:35: note: in expansion of macro '__lit'
[25-04-26 20:51:40]: 96 | #define __literal(type,value,...) __lit(type,value,__VA_ARGS__)
[25-04-26 20:51:40]: | ^~~~~
[25-04-26 20:51:40]: core/generated/lib/iec_std_lib.h:98:31: note: in expansion of macro '__literal'
[25-04-26 20:51:40]: 98 | #define __BOOL_LITERAL(value) __literal(BOOL,value)
[25-04-26 20:51:40]: | ^~~~~~~~~
[25-04-26 20:51:40]: core/generated/POUS.c:247:28: note: in expansion of macro '__BOOL_LITERAL'
[25-04-26 20:51:40]: 247 | data__->TON6 = data__->__BOOL_LITERAL(FALSE);
[25-04-26 20:51:40]: | ^~~~~~~~~~~~~~
[25-04-26 20:51:40]: core/generated/lib/iec_std_lib.h:94:31: error: expected identifier before '(' token
[25-04-26 20:51:40]: 94 | #define __lit(type,value,...) (type)value##__VA_ARGS__
[25-04-26 20:51:40]: | ^
[25-04-26 20:51:40]: core/generated/lib/iec_std_lib.h:96:35: note: in expansion of macro '__lit'
[25-04-26 20:51:40]: 96 | #define __literal(type,value,...) __lit(type,value,__VA_ARGS__)
[25-04-26 20:51:40]: | ^~~~~
[25-04-26 20:51:40]: core/generated/lib/iec_std_lib.h:98:31: note: in expansion of macro '__literal'
[25-04-26 20:51:40]: 98 | #define __BOOL_LITERAL(value) __literal(BOOL,value)
[25-04-26 20:51:40]: | ^~~~~~~~~
[25-04-26 20:51:41]: core/generated/POUS.c:250:28: note: in expansion of macro '__BOOL_LITERAL'
[25-04-26 20:51:41]: 250 | data__->TON7 = data__->__BOOL_LITERAL(FALSE);
[25-04-26 20:51:41]: | ^~~~~~~~~~~~~~
[25-04-26 20:51:41]: core/generated/lib/iec_std_lib.h:94:31: error: expected identifier before '(' token
[25-04-26 20:51:41]: 94 | #define __lit(type,value,...) (type)value##__VA_ARGS__
[25-04-26 20:51:41]: | ^
[25-04-26 20:51:41]: core/generated/lib/iec_std_lib.h:96:35: note: in expansion of macro '__lit'
[25-04-26 20:51:41]: 96 | #define __literal(type,value,...) __lit(type,value,__VA_ARGS__)
[25-04-26 20:51:41]: | ^~~~~
[25-04-26 20:51:41]: core/generated/lib/iec_std_lib.h:98:31: note: in expansion of macro '__literal'
[25-04-26 20:51:41]: 98 | #define __BOOL_LITERAL(value) __literal(BOOL,value)
[25-04-26 20:51:41]: | ^~~~~~~~~
[25-04-26 20:51:41]: core/generated/POUS.c:253:28: note: in expansion of macro '__BOOL_LITERAL'
[25-04-26 20:51:41]: 253 | data__->TON8 = data__->__BOOL_LITERAL(FALSE);
[25-04-26 20:51:41]: | ^~~~~~~~~~~~~~
[25-04-26 20:51:41]: Build failed (exit=1)
[25-04-26 20:51:41]: Compilation failed (exit code: 1).20260425_211008.jpg
Reply 0 0
thiagoralves
Hard to tell where the problem is since you haven’t shared your program
Reply 0 0
joeltackie
As in my entire program attached as a zip file?
Reply 0 0
thiagoralves
Yes
Reply 0 0
joeltackie
Yes
 
Here you go
Reply 0 0
joeltackie
Yes
The zip is in the link i sent you
Reply 0 0
thiagoralves
You haven’t given public permissions for the file on your Google Drive, so I can’t access it. You can attach it here on the forum by clicking on the paper clip icon.
Reply 0 0
joeltackie
Here you go
Reply 0 0
thiagoralves
Thanks for attaching your project. Took a quick look at it and found the issue:
Screenshot 2026-04-28 at 5.52.45 PM.png
 
You can't associate a TON instance with a coil. TON is a Function Block. Coils and contacts need BOOL variables. You can use TON0.Q on a contact because the Q output of a TON is a BOOL variable. It makes no sense to use the entire TON with a coil or contact. Take a look at IEC 61131-3 standard library concepts online to ha e a better understanding of how it works.
Reply 1 0
joeltackie
Okay thanks, i will check out asap, but that logic works with rslogix 500. MY aim was to just reset the current TON value when other related inputs come in (Something like an interlocked timer circuit )
Reply 0 0
thiagoralves
Rslogix500 is not IEC 61131-3 compliant. That has its own ladder dialect that works very differently. IEC timers are never reset. They stop counting time when the input (IN) is false. See https://infosys.beckhoff.com/english.php?content=../content/1033/tcplclib_tc2_standard/74406539.html&id=
Reply 0 0
joeltackie
Thank you very much for your assistance, can you please verify my cooling fan function block if its done right and also its integration into the main LD is right.. I am a bit lost on how the local and generated variables work in v4
Reply 0 0
Reply