Error 22 – Gotcha!

I ran across this error today in a SIMPOL program, after¬†making a number of important changes to a component in SIMPOL in the C code. I then started significantly debugging SIMPOL itself, assuming that I had broken something important. As it turns out, that was not the case, but I didn’t realize it until I had chased my tail for quite a while. The worst part is this has happened to me before, but I never made an appropriate note about it. This time, I am :).
Generally, this error occurs when you have defined a number of parameters in the IDE for passing to the command line, and there are more parameters than you have variables defined in your function main() statement. Error 22 is “local variable not dimensioned”. It is almost impossible to get this error except when you pass command line parameters to the program, so if you ever get this error, now you know where to look :).