Shop OBEX P1 Docs P2 Docs Learn Events
Version 3.10 Compiler Error and Resolution — Parallax Forums

Version 3.10 Compiler Error and Resolution

JDOhioJDOhio Posts: 72
edited 2006-08-01 00:45 in General Discussion
I was compiling some code for my project when I received an Error Code 10 (INVALID NUMBER OF PARAMETERS) on the following line:

ThrowDice  VAR  RE.1



I corrected the error temporarily by removing only the last letter of the variable name (this should have been a clue).


It wasn't until I was reviewing the code that I discovered I had named AND declared a subroutine by the same name:

ThrowDice SUB 0

ThrowDice:
'some code
RETURN

I did some renaming of course and the error was resolved.

Joe

Comments

  • BeanBean Posts: 8,129
    edited 2006-08-01 00:40
    Joe,
    Yeah, the compiler thought "ThrowDice VAR RE.1" was a call to the SUB.
    I don't know if it is stated in the help file that you cannot have a SUB with the same name as a VAR.

    BTW: I would recommend you use the new PIN directive to declare hardware pins. It allows you to "setup" the pin.
    So you could do "ThrowDice PIN RE.1 INPUT PULLUP" would setup the pin automatically as an input with pullups enabled.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com

    "You're braver than you believe, stronger than you seem, and smarter than you think" Christopher Robin to Pooh
    ·
  • JDOhioJDOhio Posts: 72
    edited 2006-08-01 00:45
    Bean,

    Yeah, I figured. It was an odd error and thought others might benefit from my mistake.

    I haven't tried the new version of the compiler although I have it installed. Just a habit I have developed to let new things bake a while [noparse];)[/noparse].

    Joe
Sign In or Register to comment.