Announcement

Collapse
No announcement yet.

Statement expected error ?

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

  • Statement expected error ?

    Hi

    The compiler is giving me a statement expected error (error 418)
    and the pointer ends up at the end of the file. I made a few changes
    to my program, but nothing that I can think of that relates to it.

    Any clues to what I should look for?

    ------------------
    Henning
    Henning

  • #2
    "Statement expected" means what it says. My guess is you have managed
    to write some odd character at the end of the file (or wherever) that
    the compiler looks at and tries to translate, but fails.

    Sometimes happens to me when I use Ctrl + C or V to copy or paste and
    I slip - and end up writing a C or a V instead. Easy to miss, but the
    compiler's error log usually shows where it is.


    ------------------

    Comment


    • #3
      Borje,

      Now, I looked at all that and still can't find any typos.
      However I just got it to work again, but how ? .. still is a
      mystery to me. Since the cursor is placed way at the bottom
      of the file and seem to create some extra lines below my code, I
      thought maybe the problem would occur in one of my include files,
      or the merging between main program and going into the include file.
      This is what I did..

      My main program's first two include files are:
      #INCLUDE "commctrl.inc"
      #INCLUDE "win32api.inc"

      I swapped their order to:
      #INCLUDE "win32api.inc"
      #INCLUDE "commctrl.inc"
      ... and it worked!

      ????????????
      btw I have had problems infrequently in the past where the compiler
      gives me statement expected errors and produces some extra lines
      at the bottom of the code. Since then I've always given my code
      a few extra space lines at the bottom which seems to protect the
      code from the compiler deleting characters at the bottom.. Am I
      dreaming here or is there a problem with that?


      ------------------
      Henning
      Henning

      Comment


      • #4
        There is not enough information here to give you an informed answer...

        You mention swapping the #INCLUDE order, but are you 100% sure you made no other changes to variable names or the code that could have contributed? For example, using a reserved word as a variable name can cause an error.

        Also, are you using the latest versions of WIN32API.INC or the versions that originally shipped with PB/DLL? The latter versions use equates to avoid problems where #INCLUDE files contain identical items.

        So, if you would like to send the code that won't compile to Tech Support (along with all #INCLUDE files, etc) so we can try to duplicate your compilation problems, we should be able to give you a specific reason for the problem.

        It's got to be better than guessing blindly or making wild assumptions, right?

        PS: The compiler NEVER writes to the source file, so your last statement about dreaming is spot on!

        ------------------
        Lance
        PowerBASIC Support
        mailto:[email protected][email protected]</A>
        Lance
        mailto:[email protected]

        Comment


        • #5
          Lance;

          well...

          honestly... all I changed was the order and it fixed it. If I
          switch back/forth now, the problem is gone.

          (I compile often and the minor changes I made to my code between
          successful compilation and not, would make any logical sense in
          causing it, nor that the switching back/forth would fix it.
          However the problem was there and now it's gone.)

          ps. I am using the latest .inc files.



          ------------------
          Henning
          Henning

          Comment


          • #6
            Hello guys,

            I would like to stand behind henning on this one. I have had this misterious error crop up once and a while to. It seems as thought the IDE puts extra characters/blank lines at the end of the source file. Please note that I am 100% sure that I did not put these characters/blank lines there.

            For me, This seems to happen mostly when dealing with larger source files and when deleting lines using CTRL-Y. I think this might have something to do with the 16bit memory handling in the IDE.

            The way I fix the problem is to go to the last line of code and hit ENTER about four times(read below why) and then highlite from that point down and hit the DELETE key.


            ENTER NOTE: I put these extra ENTER's in because I have had the IDE delete more lines from the end of my code than what I had selected.


            ------------------
            Cheers!

            Comment


            • #7
              But the editor do have some "isues" when it comes to the end of code.
              Been a while since I used PBedit now, but I remember it sometimes could
              eat a few lines at the end if one used certain key-strokes. Don't remember
              which, but something with PageDown to bottom and then delete.. something.

              In any event - the error messages given by the compiler usually includes
              a file name. If you look more closely, it may say "in win32api.inc" and
              also give you a line number. Then the editor tries to place the cursor
              at that line, in that file, but it does not check if right file is active
              which is why can you end up at the end of your code file, because it tried
              to reach line x in win32api.inc.

              BTW, just tested with different order on those two include files and it
              work fine both ways.


              ------------------

              Comment


              • #8
                Maybe I'M DREAMING, but we all know that Windows Memory Manager
                go's berserk at times, Don't We ??? Maybe Henning just reset the
                memory when he swaped includes?

                ------------------

                Comment


                • #9
                  I have had the exact same experience as Mark describes when I
                  started using the PB Editor. It does appear that the editor adds
                  lines to the end of the file every now and again for some reason.



                  ------------------
                  Paul Squires
                  www.PlanetSquires.com
                  mailto:[email protected]
                  [email protected]
                  </A>
                  Paul Squires
                  FireFly Visual Designer (for PowerBASIC Windows 10+)
                  Version 3 now available.
                  http://www.planetsquires.com

                  Comment


                  • #10
                    Yes, the editor may occasionally add a few blank lines to the end, but it does not destroy other lines by itself. Mark, the IDE is a 32-bit app, so your summation about 16-bit memory is off-base.

                    Otherwise there are a lot of anecdotal stories here, and since I use the IDE intensively on a daily basis, I would have expected to see some of these problems... I never have.

                    However, Brad suggested one oft-overlooked cause - unstable O/S... a GPF in even an unrelated app can cause Windows to go flakey, so a reboot is always worthwhile trying when there seems to be no valid reason for a compiler failure.

                    One final note: the IDE is scheduled for an overhaul soon. If anyone can produce a way to repeat any of these problems on demand, we'd dearly love to see it. (don't bother submitting any reports about the Page-Up problem - we have that particular one already!).

                    ------------------
                    Lance
                    PowerBASIC Support
                    mailto:[email protected][email protected]</A>
                    Lance
                    mailto:[email protected]

                    Comment


                    • #11
                      Changing sequence Win32Api <-> CommCtrl can lead to different code.
                      Remember, %If %NOT %DEF ...
                      Because files were uploaded many times, I can't exclude, for example, wrong commctrl.inc release.

                      PBEditor ... Yes, there are problems with redrawing, additional lines, and sometimes appears _ at the end of module.
                      But I mostly angree that it hangs (under Win2000) and it's necessary to kill wowexec.

                      ------------------
                      E-MAIL: [email protected]

                      Comment


                      • #12
                        I had a similar problem, Statement Expected, etc. Tried to compile again, usually worked OK. Reinstalled Windows, never seen it since. Conclusion: My Windows were dirty.

                        ------------------

                        Comment

                        Working...
                        X