xiaohh
Hi
 
I met one error about struct, and did not find suitable answer in the forum.
I define a simple struct as shown and attached, then tried to use variable0.x := 10; but error reported. How to deal with that?
[203128%2F9388881%2Fmceclip0]
Reply 0 0
thiagoralves
What version of the editor are you using? Your project compiles and runs on mine just fine.
Reply 0 0
xiaohh
I played with version 2025-06-09, and reported this error, I think I got this version from Github.
Then I downloaded the latest version 2024-10-16, and got the same error.
Then I uninstall OpenPLC, and have version 2024-10-16 installed again, the same error.
It's wierd.
 
 
exited with status 1 (pid 21428)
D:\work\OpenPLC\Projects\struct\build\plc.st:32-9..41-20: error: unknown error in program declaration.
In section: PROGRAM program0
0032: PROGRAM program0
0033: VAR_EXTERNAL
0034: variable0 : Point;
0035: END_VAR
0036: VAR
0037: variable1 : Point;
0038: END_VAR
0039:
0040: variable0.x := 10;
0041: variable1.x := 20;
D:\work\OpenPLC\Projects\struct\build\plc.st:49-8..49-23: error: invalid global variable(s) declaration.
In section: CONFIGURATION Config0
0049: variable0 : Point;
D:\work\OpenPLC\Projects\struct\build\plc.st:49-8..49-15: error: unexpected token after 'VAR_GLOBAL' in global variable(s) declaration.
In section: CONFIGURATION Config0
0049: variable0 : Point;
2 error(s) found. Bailing out!
Error : IEC to C compiler returned 1
PLC code generation failed !
Reply 0 0
xiaohh
I played with version 2025-06-09, and reported this error, I think I got this version from Github.
Then I downloaded the latest version 2024-10-16, and got the same error.
Then I uninstall OpenPLC, and have version 2024-10-16 installed again, the same error.
It's wierd.
 
 
exited with status 1 (pid 21428)
D:\work\OpenPLC\Projects\struct\build\plc.st:32-9..41-20: error: unknown error in program declaration.
In section: PROGRAM program0
0032: PROGRAM program0
0033: VAR_EXTERNAL
0034: variable0 : Point;
0035: END_VAR
0036: VAR
0037: variable1 : Point;
0038: END_VAR
0039:
0040: variable0.x := 10;
0041: variable1.x := 20;
D:\work\OpenPLC\Projects\struct\build\plc.st:49-8..49-23: error: invalid global variable(s) declaration.
In section: CONFIGURATION Config0
0049: variable0 : Point;
D:\work\OpenPLC\Projects\struct\build\plc.st:49-8..49-15: error: unexpected token after 'VAR_GLOBAL' in global variable(s) declaration.
In section: CONFIGURATION Config0
0049: variable0 : Point;
2 error(s) found. Bailing out!
Error : IEC to C compiler returned 1
PLC code generation failed !
 
I created one new project file in which the same struct was defined, then it works fine.
The only difference is that the old project file was created in IDE v2025-06-09.
Reply 0 0
xiaohh
Hi Thiagoralves
 
I found more details about this wierd struct issue.
The left ST file was generated by the project file, then I tried to generate .c/.h files by calling iec2c.exe.
 
if the Wierd := 1; was commented, the .c files generation will fail as shown in the red box.
But it's OK if this line was enabled as shown in the green box.
 
Can you help to check the issue? I have the project file attached also.
 
[203128%2F9389782%2Fmceclip0]
Reply 0 0
thiagoralves
It is possible that this is a particular Windows issue, as on my setup (macOS) it ran just fine. I'll check it later on a Windows VM.
Reply 1 0
Reply