News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

Compiler error when using Procedures

Started by xldaedalus, Feb 04, 2021, 05:45 PM

Previous topic - Next topic

xldaedalus

When you make certain mistakes inside a Procedure, you may see the following error during compile

"Possibly incorrect amount of parameters" or "Not enough array elements for an index value of 2"

This is appear where you've successfully compiled prior to adding a new Procedure(s).  The error will identify the first variable of ALL variables that you've declared as an array.

I'm not sure what causes this.  Being a sloppy coder, I've encountered this several times.  It's usually a misplaced  IF...ENDIF.  The one I just had was a floating ENDIF accidentally left over from an edit.

I find the error by commenting out all the code between PROC xxxx() and ENDPROC and re-compiling.  I tend to write several Procedures between compiles, so I may have to do this several times.

The above error will disappear when the offending code is commented out.  That's where you need to start looking for your error.

Never, never, never give up

keytapper

I confirm that when it's missing to close a block in a procedure, it won't be signalized the point in the procedure but elsewhere in the main code.
Ignorance comes with a cost