Recent

Author Topic: Error: in front of code  (Read 6324 times)

Eugene Loza

  • Hero Member
  • *****
  • Posts: 673
    • My games in Pascal
Error: in front of code
« on: August 03, 2017, 01:05:18 pm »
I get "Error: in front of code" error each time I try to type comments before the actual unit... Is it correct? It's just a comment on the unit purpose for pasdoc, I don't write any code there...
Lazarus 1.8.0RC3 + FPC3.0.3 Debian Jessie 64 bit
« Last Edit: August 03, 2017, 01:08:11 pm by Eugene Loza »
My FOSS games in FreePascal&CastleGameEngine: https://decoherence.itch.io/ (Sources: https://gitlab.com/EugeneLoza)

Thaddy

  • Hero Member
  • *****
  • Posts: 14367
  • Sensorship about opinions does not belong here.
Re: Error: in front of code
« Reply #1 on: August 03, 2017, 01:10:52 pm »
*Before* either unit or program or library, only comments are allowed. Not plain text.
Your screenshot hides the beginning.... I suspect you are trying to include something before the comment.

Show us the beginning of your unit.... or program....or library
« Last Edit: August 03, 2017, 01:13:07 pm by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

Eugene Loza

  • Hero Member
  • *****
  • Posts: 673
    • My games in Pascal
Re: Error: in front of code
« Reply #2 on: August 03, 2017, 01:20:34 pm »
I suspect you are trying to include something before the comment.
Show us the beginning of your unit.... or program....or library
Nope, nothing in front. Just a GPLv3 statement and comments.
Here's the full code: https://github.com/eugeneloza/decoherence/blob/master/decocreatures.pas
UPD: I've attached the unit, as I've removed it from the project (due to wrong architecture).
It's not the only unit which features this "error", I experienced it a few times recently. Looks like it started showing up with 1.8.0RC3 because I've never seen anything like that before.

P.S. The error doesn't persist and shows only after I paste the GPLv3 statement in the code and start editing the unit's comment. It doesn't prevent from successfully compiling the whole project. Neither it shows up after I've compiled everything (later editing the comment doesn't show any error).
« Last Edit: August 03, 2017, 03:22:55 pm by Eugene Loza »
My FOSS games in FreePascal&CastleGameEngine: https://decoherence.itch.io/ (Sources: https://gitlab.com/EugeneLoza)

Thaddy

  • Hero Member
  • *****
  • Posts: 14367
  • Sensorship about opinions does not belong here.
Re: Error: in front of code
« Reply #3 on: August 03, 2017, 03:45:33 pm »
Well, it complains about the include file, so what do you mean?
If I can't examine that I can not debug the code.....
I suspect, though, you have to put it in the interface section, not before it...
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

Eugene Loza

  • Hero Member
  • *****
  • Posts: 673
    • My games in Pascal
Re: Error: in front of code
« Reply #4 on: August 03, 2017, 03:59:18 pm »
Quote
If I can't examine that I can not debug the code.....
of course :D... in order to compile the actual code you have to download all the project (~50 units) and properly install CastleGameEngine. And as I've written it fires only once, after pasting the GPLv3 statement (and not always).
I couldn't reproduce the error on a "clean" project, neither in "what is exact sequence of actions causing this" (it happened several times, just now I've made a few test units and it didn't show any error).
Quote
I suspect, though, you have to put it in the interface section, not before it...
hmm... I just replace {$mode objfpc}{$H+} with my include (which includes this string).
Nothing special, just some compiler config https://github.com/eugeneloza/decoherence/blob/master/compilerconfig.inc
My FOSS games in FreePascal&CastleGameEngine: https://decoherence.itch.io/ (Sources: https://gitlab.com/EugeneLoza)

Thaddy

  • Hero Member
  • *****
  • Posts: 14367
  • Sensorship about opinions does not belong here.
Re: Error: in front of code
« Reply #5 on: August 03, 2017, 04:20:41 pm »
The unit simply compiles with the include (and excluding uses CastleCreatures and irrelevant change DCreature = class (Tobject)
). I guess it is solved?
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

Eugene Loza

  • Hero Member
  • *****
  • Posts: 673
    • My games in Pascal
Re: Error: in front of code
« Reply #6 on: August 03, 2017, 04:31:27 pm »
I guess it is solved?
Nope.  ;)
I've written above the unit compiles EVEN when there is an error shown. There's absolutely no other problem. Just an error shown there. Nothing more.
My FOSS games in FreePascal&CastleGameEngine: https://decoherence.itch.io/ (Sources: https://gitlab.com/EugeneLoza)

Eugene Loza

  • Hero Member
  • *****
  • Posts: 673
    • My games in Pascal
Re: Error: in front of code
« Reply #7 on: August 03, 2017, 04:34:09 pm »
I've found an exact sequence to reproduce the error.
1. File>New>Application
2. Make a comment block above unit1.
3. Start typing a comment and use generic FPC operators/expressions. ANY valid operator like "WriteLn(" would result in showing this error.
My FOSS games in FreePascal&CastleGameEngine: https://decoherence.itch.io/ (Sources: https://gitlab.com/EugeneLoza)

Ondrej Pokorny

  • Full Member
  • ***
  • Posts: 220
Re: Error: in front of code
« Reply #8 on: August 03, 2017, 05:04:02 pm »
I've found an exact sequence to reproduce the error.
1. File>New>Application
2. Make a comment block above unit1.
3. Start typing a comment and use generic FPC operators/expressions. ANY valid operator like "WriteLn(" would result in showing this error.

Great, please report to mantis.

Eugene Loza

  • Hero Member
  • *****
  • Posts: 673
    • My games in Pascal
Re: Error: in front of code
« Reply #9 on: August 03, 2017, 05:19:30 pm »
Great, please report to mantis.
I'm afraid I'm too inexperienced programmer to do that... I've tried a few times, and the response was always similar to "It's a feature, not a bug. If you don't know something, post in the forum, not on bugtracker". Actually I cannot disagree with my lack of deep knowledge of FPC, so I've decided to leave bugreports to more experienced users. I can't be sure if this is really a bug in IDE or FPC (not a bug of my understanding/expectations) and worth attention of developers. If someone with better understanding of freepascal and bugtracker policy believes it's a bug, I'd be very thankful for filling in the bugreport for this issue, the information and the screenshot provided in my previous message should be enough. Thou, again, I'm not experienced enough to be sure if its a bug.
My FOSS games in FreePascal&CastleGameEngine: https://decoherence.itch.io/ (Sources: https://gitlab.com/EugeneLoza)

Bart

  • Hero Member
  • *****
  • Posts: 5289
    • Bart en Mariska's Webstek
Re: Error: in front of code
« Reply #10 on: August 03, 2017, 06:08:54 pm »
Reported a issue #32235.

Bart

Eugene Loza

  • Hero Member
  • *****
  • Posts: 673
    • My games in Pascal
Re: Error: in front of code
« Reply #11 on: August 03, 2017, 06:13:58 pm »
My FOSS games in FreePascal&CastleGameEngine: https://decoherence.itch.io/ (Sources: https://gitlab.com/EugeneLoza)

Thaddy

  • Hero Member
  • *****
  • Posts: 14367
  • Sensorship about opinions does not belong here.
Re: Error: in front of code
« Reply #12 on: August 03, 2017, 08:43:03 pm »
So, for now disable codetools. That's why I did not get an error.....
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9864
  • Debugger - SynEdit - and more
    • wiki
Re: Error: in front of code
« Reply #13 on: August 04, 2017, 12:24:03 am »
When it happens next time:

Do this for the
1) active unit in Source Edit
2) the unit that is mentioned in the error (switch tab to the error unit)

For each go to menu "View" > "Ide internals" > "show codetools nodeinfo"

Copy the info of all 3 tabs, and attach to the bug report.


Bart

  • Hero Member
  • *****
  • Posts: 5289
    • Bart en Mariska's Webstek
Re: Error: in front of code
« Reply #14 on: August 04, 2017, 09:33:25 am »
For each go to menu "View" > "Ide internals" > "show codetools nodeinfo"

There is no such menu entry in my IDE (trunk).
The "IDE Internals" menu shows 3 submenu's:
- About FPC
- About IDE
- What needs buiding

Bart

 

TinyPortal © 2005-2018