Announcement

Collapse
No announcement yet.

Mysterious error message

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Mysterious error message

    At the end of an already dozen times compiled code of exactly 9014 lines I simply add another SUB. It's original trial content is:

    Sub blahblahblah()
    Local lRet As Long
    Local Hwnd As Long
    End sub

    The thrown out error message is:

    Statement expected
    Line 9017: Local lRet As Long

    Statement expected - A PowerBASIC statement was expected. Some character could not be identified as a statement, metastatement, or variable.

    Replacing the added four lines with any other sequence gives always back the same error.

    How can interpret this?
    Norbert Doerre

  • #2
    What is the column of the error (row:column)?

    Is lRet defined elsewhere in the program?

    What happens if you add the SUB to the beginning instead of the end?

    -- Eric
    "Not my circus, not my monkeys."

    Comment


    • #3
      Eric, I can in fact add the code elsewhere just with the SAME result.
      lRet is a standard variable in all my functions and subs.
      I also edited the four lines with TOPGUN, a very small ASM coded text editor, just to examine it for occurrence of unwanted chars. But all seems to be correct.
      It's just as if PB compiler were at it's limit.
      Norbert Doerre

      Comment


      • #4
        FOUND THE BUG!!!
        Code:
        Sub blahblahblah()
            Local lRet As Long
            Local Hwnd As Long
        End sub
        It seems to be unbelievable, but it's in fact as I describe here:
        The line "Local lRet As long" was preceded by three spaces instead of one tab.
        I replaced the spaces by the tab - and the compiler is working again!
        Replacing the tab with three spaces again results in no error, too.
        So, what could have been the cause?
        Norbert Doerre

        Comment


        • #5
          Originally posted by norbert doerre View Post
          So, what could have been the cause?
          My guess is some (invisible) control character in the code line.
          I've had this in the past, where looking at the code with a disk hex editor (Frhed) would reveal some invisible control character that would cause the error.
          Most of the time this was due to copying code from some place else (like a help file, internet forums, etc.).
          Deleting and retyping the offending line would help in that case.

          Kind regards
          Eddy

          Comment


          • #6
            Originally posted by norbert doerre View Post
            So, what could have been the cause?
            The alleged "3 spaces" were "not 3 spaces". Perhaps one of them was a CHR$(&HA0) which displays as a blank space. Some text editors add the hi bit as an internal marker. Perhaps something else... but you can take the phrase "not 3 spaces" to the bank. {smile}

            Bob Zale
            PowerBASIC Inc.

            Comment


            • #7
              One of the "Spaces" may have in fact been an unprintable character. So if you can't see it, you can't find it.
              Engineer's Motto: If it aint broke take it apart and fix it

              "If at 1st you don't succeed... call it version 1.0"

              "Half of Programming is coding"....."The other 90% is DEBUGGING"

              "Document my code????" .... "WHYYY??? do you think they call it CODE? "

              Comment


              • #8
                Bob, I was shure that something was wrong with the source code, because I could move it anywhere in the whole code, and the error was always the same. Next time, I'll use WinHex. But it was already too late to use it. Now I know at least that my editor can be used to progam binaries.
                Thanks!
                Norbert Doerre

                Comment


                • #9
                  Norbert,
                  Where is WinHex? In downloads maybe?

                  If it does what I am hoping I would love to take a look at it.

                  Guessing it scans your code to show non-printable characters?
                  Engineer's Motto: If it aint broke take it apart and fix it

                  "If at 1st you don't succeed... call it version 1.0"

                  "Half of Programming is coding"....."The other 90% is DEBUGGING"

                  "Document my code????" .... "WHYYY??? do you think they call it CODE? "

                  Comment


                  • #10
                    Cliff, pls have a look into Your private forum msg.
                    Norbert Doerre

                    Comment

                    Working...
                    X