Lazarus
Using the Lazarus IDE => Editor => Topic started by: Mikenoworth on April 16, 2005, 09:41:03 pm
-
Alright. This one is baffling me. I have compiled my test app. about.. Ooo.. 100-150 times already.. Well after making some quick bug fixes, I compiled it again, and got this error:
Unit1.lrs(3,1) Fata: Syntax error, ";" expected but "identifier LAZARUSRESOURCES" found.
I'm not sure what to make of it. I checked all the units included with a template app, and they're all there. Is there a file I might have changed unknowingly ?? Some code somewhere ?? Any help please, I'd really like to continue programming my script engine. :D
P.S. - I have attempted reinstalling Lazarus. Installed fine, same error. I would like to not have to remove it and install, but since an install did not change, it must be a project problem (code somewhere, project file messed up some where).
-
Add LResources to your uses clause ion the Unit1.pas.
After doing this the compile should work. ;)
-
----------------------------------------------------------------------------------------------------------
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
Script, Buttons;
----------------------------------------------------------------------------------------------------------
Sorry. I didn't state it well, but I did check my uses clause before hand, it's already there.
I thought about replacing it with a fresher lresources (maybe it became corrupt) but replacing it was already done, as I said, I reinstalled Lazarus.
Maybe I could remove it from uses, attempt a compile, the add it again and compile.
-
Removing it and adding it again did not work either. This is very frustrating.
-
Ah, I found something. The LFM file seems to contain some invalid entries, which was reported by lazarus after loading another project, then loading my current project again. But, it doesn't say what or where, so I guess I'll go through it and see what may be wrong, of course.. I don't see how this ties to lazarusresources not being found, but I will give it a shot. :D
-
--------------------------------------------------------------------------------------------------------------------
object Form1: TForm1
Caption = 'Script Engine Test Application'
ClientHeight = 466
ClientWidth = 572
OnCreate = Form1Create
PixelsPerInch = 96
HorzScrollBar.Page = 571
VertScrollBar.Page = 465
Left = 534
Height = 466
Top = 320
Width = 572
object Label1: TLabel
Caption = 'Total Amount of Variables'
Color = clNone
Left = 392
Height = 12
Top = 24
Width = 127
end
object Label2: TLabel
Caption = 'Variable'
Color = clNone
Height = 18
Top = 10
Width = 44
end
object Label3: TLabel
Caption = 'Value'
Color = clNone
Left = 160
Height = 20
Top = 8
Width = 32
end
object Label4: TLabel
BorderSpacing.OnChange = nil
Caption = 'Instruction'
Color = clNone
Height = 16
Top = 56
Width = 63
end
object ComboBox1: TComboBox
MaxLength = 0
OnChange = ComboBox1Change
TabOrder = 0
Text = 'ComboBox1'
Height = 21
Top = 27
Width = 152
end
object Edit1: TEdit
BorderSpacing.OnChange = nil
TabOrder = 1
Text = 'Edit1'
Left = 160
Height = 22
Top = 26
Width = 146
end
object ComboBox2: TComboBox
BorderSpacing.OnChange = nil
MaxLength = 0
TabOrder = 2
Text = 'ComboBox2'
Height = 21
Top = 72
Width = 152
end
object Edit3: TEdit
BorderSpacing.OnChange = nil
TabOrder = 3
Text = 'Edit3'
Height = 22
Top = 440
Width = 496
end
object Button2: TButton
BorderSpacing.OnChange = nil
Caption = 'Clear'
TabOrder = 4
Left = 520
Height = 18
Top = 440
Width = 35
end
object GroupBox1: TGroupBox
BorderSpacing.OnChange = nil
Caption = 'Instruction Syntax'
ClientHeight = 30
ClientWidth = 406
ParentColor = True
TabOrder = 5
Left = 158
Height = 48
Top = 56
Width = 410
object Label5: TLabel
BorderSpacing.OnChange = nil
Caption = 'Syntax Display Panel'
Color = clNone
Left = 8
Height = 16
Top = 8
Width = 358
end
end
object Memo1: TMemo
BorderSpacing.OnChange = nil
Lines.Strings = (
'Memo1'
)
TabOrder = 6
Height = 320
Top = 112
Width = 570
end
end
--------------------------------------------------------------------------------------------------------------------
{ TForm1 }
TForm1 = class(TForm)
Button2: TButton;
ComboBox1: TComboBox;
ComboBox2: TComboBox;
Edit1: TEdit;
Edit3: TEdit;
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Memo1: TMemo;
procedure ComboBox1Change(Sender: TObject);
procedure Form1Create(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
--------------------------------------------------------------------------------------------------------------------
Hm. I don't see anything wrong with it, but I don't know exactly what should be there and what shouldn't.
Anybody have any ideas?
-
FIXED - :D
I had done this:
-----------------------------------------------------------------------------------
for temp_loop := 0 to TScript.instruction_count() do
begin
tmp_ins := TScript.get_instruction(temp_loop);
if tmp_ins <> nil then
with tmp_ins^ do
ComboBox2.Items.Add(get_id);
// MAIN SCRIPT CONSOLE INPUT
edit3.Text := '';
end;
initialization
{$I Unit1.lrs}
end.
-----------------------------------------------------------------------------------
when it should have been this:
-----------------------------------------------------------------------------------
for temp_loop := 0 to TScript.instruction_count() do
begin
tmp_ins := TScript.get_instruction(temp_loop);
if tmp_ins <> nil then
with tmp_ins^ do
ComboBox2.Items.Add(get_id);
end; // <-- cause of all my pain
// MAIN SCRIPT CONSOLE INPUT
edit3.Text := '';
end;
initialization
{$I Unit1.lrs}
end.
-----------------------------------------------------------------------------------
With a problem so simplistic and occurable, neither lazarus or fpc
could rule that an END was missing. Even with an 'initialization' inside
the block, neither knew what the hell to make of it. Hey, fpc + Lazarus for life,
but that was damned annoying to stumble upon, AND to realize what the
real problem was.