Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-05

My Island_maker D5/7 port test code - Syntax error, "identifier" expected but "BEGIN" found

9 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Peter E Williams

Hi All,

I am running Linux Ubuntu 10.10 LTS with Lazarus latest version updated 2 days ago

And WINE running Delphi 5 Enterprise Update 2 and 7 Enterprise (not sure what update) (c) 2002

After installing D5E and D7E I used CCleaner 2.2 (in WINE) to fix the missing file errors & registry problems.

<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<Version Value="7"/>
<General>
<MainUnit Value="0"/>
<TargetFileExt Value=""/>
<Title Value="island_maker"/>
<Icon Value="0"/>
<UseXPManifest Value="True"/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
<Language Value=""/>
<CharSet Value=""/>
</VersionInfo>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh| xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> </PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="1">
<Item1>
<PackageName Value="LCL"/>
</Item1>
</RequiredPackages>
<Units Count="1">
<Unit0>
<Filename Value="island_maker.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="island_maker"/>
<CursorPos X="20" Y="5"/>
<TopLine Value="1"/>
<UsageCount Value="20"/>
<SyntaxHighlighter Value="Delphi"/>
</Unit0>
</Units>
<JumpHistory Count="0" HistoryIndex="-1"/>
</ProjectOptions>
<CompilerOptions>
<Version Value="8"/>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

Hint: Start of reading config file /etc/fpc.cfg
Hint: End of reading config file /etc/fpc.cfg
Free Pascal Compiler version 2.4.0-2 [2010/03/06] for i386 Copyright (c) 1993-2009 by Florian Klaempfl
Target OS: Linux for i386
Compiling island_maker1.lpr
island_maker1.lpr(12,1) Fatal: Syntax error, "identifier" expected but "BEGIN" found

Love and Friendship, Peter Eric Williams +61 3 6236-9675 (home or leave a message) Mobile 044-99-256-50 Proudly created in Australia. Quality Cross-Platform Games since 1970 with a Commodore PET 4016 with 16 Kilobytes of RAM (not Megabytes). -------------- next part -------------- A non-text attachment was scrubbed... Name: island_maker.pas Type: text/x-pascal Size: 279 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100522/5a4fa29e/attachment-0003.bin> -------------- next part -------------- initialization {$I main_island.lrs} object main_island: TForm1 Left = 77 Height = 588 Top = 100 Width = 792 Caption = 'Here is your random island. It was started at * and finished at @.' ClientHeight = 554 ClientWidth = 792 Font.Height = -11 Font.Name = 'MS Sans Serif' Menu = MainMenu1 OnCreate = FormCreate ParentFont = False LCLVersion = '0.9.26' object Memo1: TMemo Height = 554 Width = 792 Align = alClient Alignment = taCenter Font.CharSet = ANSI_CHARSET Font.Height = -11 Font.Name = 'Times New Roman' ParentFont = False ScrollBars = ssBoth TabOrder = 0 end object MainMenu1: TMainMenu left = 120 top = 16 object File1: TMenuItem Caption = '&File' object CreateaNewIsland1: TMenuItem Caption = '&Create a New Island' OnClick = CreateaNewIsland1Click end object SaveIslandtoFile1: TMenuItem Caption = '&Save Island to File' OnClick = SaveIslandtoFile1Click end end object Options1: TMenuItem Caption = '&Options' object SetHorizontalMaxSize1: TMenuItem Caption = 'Set &Maximum Size' OnClick = SetHorizontalMaxSize1Click end end end object SaveDialog1: TSaveDialog DefaultExt = '.txt' Filter = 'Text Files|*.txt' left = 168 top = 16 end end -------------- next part -------------- A non-text attachment was scrubbed... Name: main_island.pas Type: text/x-pascal Size: 9212 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100522/5a4fa29e/attachment-0004.bin> -------------- next part -------------- A non-text attachment was scrubbed... Name: set_max.pas Type: text/x-pascal Size: 694 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100522/5a4fa29e/attachment-0005.bin>

Reply by email

Vannus
to Peter E Williams

thats the lpi file youve quoted, could you quote/attach the lpr file?

heres an example you could compare with. (youre probably just missing ; or something)

program project1;
{$mode objfpc}{$H+}

uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, Unit1, LResources, Unit2
{ you can add units after this };

{$IFDEF WINDOWS}{$R project1.rc}{$ENDIF}
begin
Application.Title:='Exit';
{$I project1.lrs}
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm2, Form2);
Application.Run;
end.

HTH

- V
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100522/a0d1c399/attachment.html>

Reply by email

Peter E Williams
to Vannus

Hi Vannus and all,

Love and Friendship, Peter Eric Williams +61 3 6236-9675 (home or leave a message) Mobile 044-99-256-50 Proudly created in Australia. Quality Cross-Platform Games since 1970 with a Commodore PET 4016 with 16 Kilobytes of RAM (not Megabytes). On Sat, 2010-05-22 at 00:52 +0100, Vannus wrote: > thats the lpi file youve quoted, could you quote/attach the lpr file? > I had a look in the folder for the project and there was not .lpr file present. I created a new project and modified it as follows: program island_maker1; {$MODE Delphi} uses Forms, Unit1 in 'set_max.pas' {Form1}, Unit2 in 'main_island.pas' {Form2}, {$R *.res} begin Application.Title:='DTM Island Maker'; Application.Initialize; Application.CreateForm(Tmain_island_form, Form2); Application.Run; end. Now I am getting 2 different errors: Hint: Start of reading config file /etc/fpc.cfg Hint: End of reading config file /etc/fpc.cfg Free Pascal Compiler version 2.4.0-2 [2010/03/06] for i386 Copyright (c) 1993-2009 by Florian Klaempfl Target OS: Linux for i386 Compiling project1.pas Compiling set_max.pas Compiling main_island.pas >line 71 procedure FormCreate(Sender: TObject); main_island.pas(71,26) Hint: Parameter "Sender" not used >line 72 procedure CreateaNewIsland1Click(Sender: TObject); main_island.pas(72,38) Hint: Parameter "Sender" not used >line 73 procedure SaveIslandtoFile1Click(Sender: TObject); main_island.pas(73,38) Hint: Parameter "Sender" not used var main_island_form : Tmain_island_form; island : island_type; max_x, max_y : integer; procedure Tmain_island_form.SetHorizontalMaxSize1Click(Sender: TObject); begin set_max_form := tset_max_form.create( nil ); with set_max_form do begin try >line 270 max_x := inttostr( max_x_param.text ); // ^^^^^^^^^^^ it is a TEdit main_island.pas(270,41) Error: Incompatible type for arg no. 1: Got "TTranslateString", expected "QWord" Hint: Found declaration: IntToStr(QWord):AnsiString; Hint: Found declaration: IntToStr(Int64):AnsiString; Hint: Found declaration: IntToStr(LongInt):AnsiString; >line 271 max_y := inttostr( max_y_param.text ); // ^^^^^^^^^^^ it is a TEdit main_island.pas(271,41) Error: Incompatible type for arg no. 1: Got "TTranslateString", expected "QWord" Hint: Found declaration: IntToStr(QWord):AnsiString; Hint: Found declaration: IntToStr(Int64):AnsiString; Hint: Found declaration: IntToStr(LongInt):AnsiString; if showmodal = mrOK then begin try main_island.pas(308) Fatal: There were 2 errors compiling module, stopping in Unit set_max.pas Tset_max_form = class(TForm) max_x_param: TEdit; max_y_param: TEdit; Selecting Help from the message window gives this error. The path to the Help Help was blank even tho' it has apparently been installed. I don't know where to set the path to (default location). I tried the online help but got lost :-((( Help not found No help found for "main_island.pas(270,41) Error: Incompatible type for arg no. 1: Got "TranslateString", expected "QWord"" [Cancel] > > > HTH > > > - V Peter

Reply by email

Mattias Gaertner
to Peter E Williams
max_x := inttostr( max_x_param.text ); // ^^^^^^^^^^^ it is a TEdit main_island.pas(270,41) Error: Incompatible type for arg no. 1: Got "TTranslateString", expected "QWord"

Use StrToInt or StrToIntDef(,0)

Mattias

Reply by email

Alberto Narduzzi
to Peter E Williams: Love and Friendship, Peter Eric Williams +61 3 6236-9675 (home or leave a message) Mobile…

Hi,

the two hints, you may just ignore them; they just inform you that within the event handler you are not using the parameter.

Then, for the errors:

     max_y := inttostr( max_y_param.text );
//                     ^^^^^^^^^^^ it is a TEdit

inttostr _gets_ an integer as parameter and produces its representation string. You probably wanted to use strtoint, instead.

Cheers, A.

Reply by email

Vannus
to patspiper
Show quoted text 6 lines
uses Forms, Unit1 in 'set_max.pas' {Form1}, Unit2 in 'main_island.pas' {Form2}; <-- semi colon

???

wheres 'program' ?

where 'begin' & 'end' and the coide in between ?

at the minimum there needs to be:-

program hello;
begin
    // do something ie:-  writeln('Hello');
end.

which is usually in proect1.lpr or project1.pas and rarely (if ever) in unit1.pas or unit2.pas

HTH,
- V
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100522/602e510f/attachment.html>

Reply by email

patspiper
to Vannus
Vannus wrote 26 lines
uses Forms, Unit1 in 'set_max.pas' {Form1}, Unit2 in 'main_island.pas' {Form2}; <-- semi colon ??? wheres 'program' ? where 'begin' & 'end' and the coide in between ? at the minimum there needs to be:- program hello; begin // do something ie:- writeln('Hello'); end. which is usually in proect1.lpr or project1.pas and rarely (if ever) in unit1.pas or unit2.pas HTH, - V

HTH who? Me or the OP ;)

The minimum that you have mentioned is already included in the OP's program file, but his uses clause is improperly terminated.

HTH
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100522/7d59ab0f/attachment-0001.html>

Reply by email

Vannus
to patspiper
HTH who? Me or the OP ;)

sorry - i thought you were the OP!

The minimum that you have mentioned is already included in the OP's program file, but his uses clause is improperly terminated.

my bad, i ddin't realise the program file was there, was expecting .lpr

- V
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100523/f7ed6740/attachment-0001.html>

Reply by email