Alex416c
Hello,
Im getting an error when trying to access array elements and Im not sure how to fix it. It is saying I need to use pointers to reference '__IEC___ARRAY_OF_INT_3_p::value'
 
Below is the full error message and my half baked code.
debug.cpp:260:61: error: request for member ‘table’ in ‘RES0__INSTANCE0.MAIN::TRAINCONDUCTOR0.TRAINCONDUCTOR::SEGMENT2TRAINS.__IEC___ARRAY_OF_INT_3_p::value’, which is of pointer type ‘__ARRAY_OF_INT_3*’ (maybe you meant to use ‘->’ ?)
Reply 0 0
PeBi
Hello,
I just opened your project to test it and it translated without any errors. However, I activated “compile only.”
 
 
[17:04:04]: Starting compilation process...
[17:04:04]: Compiling program for project: C:\Users\P\Documents\OPENPLC_4\Trains3 and board target: OpenPLC Runtime v3
[17:04:04]: Host Hardware Info:
[17:04:04]: System Architecture - x64
[17:04:04]: Operating System - win32
[17:04:04]: Processor - Intel64 Family 6 Model 60 Stepping 3, GenuineIntel
[17:04:04]: Logical CPU Cores - 4
[17:04:04]: CPU Frequency - 2993 MHz
[17:04:04]: CPU Model - Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz
[17:04:04]: Checking tools availability...
[17:04:05]: Arduino CLI available at version 1.1.1
[17:04:05]: IEC2C available at version 0.1
[17:04:05]: Directories for compilation source files created.
[17:04:05]: Generated XML from JSON at: C:\Users\P\Documents\OPENPLC_4\Trains3\build\OpenPLC Runtime v3\src
[17:04:06]: Compiling file C:\Users\P\Documents\OPENPLC_4\Trains3\build\OpenPLC Runtime v3\src\plc.xml
[17:04:06]: Collecting data types
[17:04:06]: Collecting POUs
[17:04:06]: Generate POU SWITCH_TRACK
[17:04:06]: [["[('Flipflop0', ('P::SWITCH_TRACK', 'contact', 9700907, 'reference'))]", "[('Position', ('P::SWITCH_TRACK', 'contact', 4727947, 'reference'))]"]]
[17:04:06]: Generate POU Toggle
[17:04:06]: [["[('Flipflop0', ('P::Toggle', 'contact', 7537262, 'reference'))]", "[('Output_A', ('P::Toggle', 'contact', 10090746, 'reference'))]"]]
[17:04:06]: Generate POU TrainConductor
[17:04:06]: Generate POU main
[17:04:06]: Generate POU SegmentControl
[17:04:06]: Generate Config(s)
[17:04:06]: Stage 1 compilation finished successfully
[17:04:06]: Saving ST file...
[17:04:06]: Parsing complex variables...
[17:04:07]: ST file generated at: C:\Users\P\Documents\OPENPLC_4\Trains3\build\OpenPLC Runtime v3\src\ program.st
[17:04:07]: Copying static files...
[17:04:07]: Static files copied successfully.
[17:04:08]: POUS.c
[17:04:08]: POUS.h
[17:04:08]: LOCATED_VARIABLES.h
[17:04:08]: VARIABLES.csv
[17:04:08]: Config0.c
[17:04:08]: Config0.h
[17:04:08]: Res0.c
[17:04:08]: C files generated at: C:\Users\P\Documents\OPENPLC_4\Trains3\build\OpenPLC Runtime v3\src\
[17:04:10]: Debug files generated at: C:\Users\P\Documents\OPENPLC_4\Trains3\build\OpenPLC Runtime v3\src
[17:04:10]: Extracted MD5 hash from program.st: 62337ea79458ac9da35238487e3abbcb
[17:04:11]: Generating glue variables...
[17:04:11]: Linking variable __IX0_3
[17:04:11]: Linking variable __IX0_2
[17:04:11]: Linking variable __QX0_0
[17:04:11]: Linking variable __QX0_1
[17:04:11]: Linking variable __QW100
[17:04:11]: Linking variable __QW101
[17:04:11]: Linking variable __QX0_2
[17:04:11]: Linking variable __QX0_3
[17:04:11]: Linking variable __QX0_4
[17:04:11]: Linking variable __QX0_5
[17:04:11]: Linking variable __QX0_6
[17:04:11]: Linking variable __MW100
[17:04:11]: Linking variable __MW101
[17:04:11]: Linking variable __MW102
[17:04:11]: Linking variable __MW103
[17:04:11]: Linking variable __MW104
[17:04:11]: Glue variables saved to C:\Users\P\Documents\OPENPLC_4\Trains3\build\OpenPLC Runtime v3\src\glueVars.c
[17:04:12]: Glue vars generated at: C:\Users\P\Documents\OPENPLC_4\Trains3\build\OpenPLC Runtime v3\src
[17:04:12]: No C/C++ blocks found, skipping c_blocks.h generation
[17:04:12]: No C/C++ blocks found, skipping c_blocks_code.cpp generation
[17:04:12]: Embedded c_blocks.h into program.st for Runtime v3
[17:04:12]: Embedded c_blocks_code.cpp into program.st for Runtime v3
[17:04:12]: OpenPLC runtime detected.
[17:04:12]: Source files generated successfully at: C:\Users\P\Documents\OPENPLC_4\Trains3\build\OpenPLC Runtime v3\src
[17:04:12]: Compile only mode - skipping upload to runtime.
[17:04:12]: -------------------------------------------------------------------------------------------------------------
Reply 0 0
thiagoralves
This is a bug on the editor (actually on a component of the editor called xml2st) that has been fixed here https://github.com/Autonomy-Logic/xml2st/commit/010313d8c51da15401d13ba311391a09a21bf63c
 
It will be available on the next editor build release. If you want to test the fix now you can build the editor from the development branch
Reply 0 0
Alex416c
Cool thank you. Found away around it in the current version, copy the array into a local variable at the start of the script and copy the local back into the external at the end
Reply 1 0
Reply