Free Pascal Fatal Syntax Error
Contents |
List Lazarus Website Downloads (Laz+FPC) FAQ Wiki Bugtracker IRC channel Developer Blog
Fatal Syntax Error Expected But Var Found
Follow us on Twitter Latest SVN Mailing List fatal: syntax error, ; expected but else found Other languages Foundation Website Useful Wiki Links Project Roadmap Getting the
Fatal Syntax Error . Expected But End Of File Found
Source Screenshots About donations (wiki) Bookstore Computer Math and Games in Pascal Lazarus, the complete guide (only a few left) Search Advanced search « previous next » expected but found Print Pages: [1] Author Topic: [SOLVED] problem with compiler : Fatal: Syntax error, "identifier" expec (Read 8873 times) nicola69 New member Posts: 15 [SOLVED] problem with compiler : Fatal: Syntax error, "identifier" expec « on: January 07, 2013, 04:32:17 pm » HiI need read and write excel 2010 files from my lcl application.I try to use OLE.I write this simple applicationprocedure TForm1.Button1Click(Sender: TObject);Var XLApp,XLSHEET: OLEVariant; lastrow : integer;begin XLApp := CreateOleObject('Excel.Application'); // requires comobj in usestry XLApp.Visible := False; // Hide Excel XLApp.DisplayAlerts := False; if not OpenDialog1.Execute then exit; XLApp.Workbooks.Open(OpenDialog1.FileName); XLSHEET := XLApp.Workbooks.Sheets(0).Select; lastrow:= XLSHEET.Range('A65536').End(xlUp).Row; finallyend; fpc don't generate exe because i receive an error in lastrow:= XLSHEET.Range('A65536').End(xlUp).Row;My error is unit1.pas(48,38) Fatal: Syntax error, "identifier" expected but "END" foundhow can I resolve this error ? « Last Edit: January 10, 2013, 11:03:58 am by nicola69 » Logged Blaazen Hero Member Posts: 2340 POKE 54296,15 Re: problem with compiler : unit1.pas) Fatal: Syntax error, "identifier" expec « Reply #1 on: January 07, 2013, 05:03:02 pm » You have to add one "end;" at the end.The valid construction is:Code: [Select] try
...
finally
...
end;
Logged Lazarus 1.7 r52036M FPC 3.0.0 x86_64-linux-qt Chakra, Qt 4.8.7, Plasma 5.5Lazarus 1.4RC3 r48629 FPC 2.6.4 i386-wi
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up What's wrong with this Pascal syntax? up vote 0 down vote favorite I can't understand http://forum.lazarus.freepascal.org/index.php?topic=19463.0 what's going on here. Can you give me a hand? This is the problematic code: While not EOF(Archi) do begin index:= index + 1; Read(Archi, Alumno[index]); Promes[index] := (Alumno[index].nota1 + Alumno[index].nota2) / 2; if Promes[index] >= 6 then begin alguPromo := true; PromosIndex := PromosIndex + 1; Promos[PromosIndex]:= Alumno[index]; end; else begin if Promes[index] > 4 then cantiRecu:= cantiRecu + 1; else begin LibresIndex += 1; Libres[LibresIndex] := Alumno[index]; end; end; http://stackoverflow.com/questions/12604323/whats-wrong-with-this-pascal-syntax end; The compiler marks error in the line 10 of this code (else begin). The error is: Fatal: Syntax error, ; expected but ELSE found. If someone wants to tray compile here is the entire code: http://pastebin.com/dRg1Lguu pascal share|improve this question edited Sep 26 '12 at 14:50 asked Sep 26 '12 at 14:43 sanfilippopablo 4581611 Are you sure that pascal support += operator? –CAMOBAP Sep 26 '12 at 14:44 What is the problem with the code? –BugFinder Sep 26 '12 at 14:46 2 There should not be a semicolon after the end before the else. Ditto for the line cantiRecu:= cantiRecu + 1 - this should not have a semicolon either. –Paul R Sep 26 '12 at 14:47 Thanks man! Was the semicolon! I had a suspect that was that, but i couldn't fix it. Done. Thanks man. –sanfilippopablo Sep 26 '12 at 14:55 @user1491651: OK - I've fleshed this out into a complete answer now - please up-vote and accept it if it has been useful to you. –Paul R Sep 26 '12 at 14:57 add a comment| 2 Answers 2 active oldest votes up vote 5 down vote accepted Note that in Pascal the semicolon is a separator, not a
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more http://stackoverflow.com/questions/20167042/syntax-error-expected-but-until-found about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up syntax error, ';' expected but 'until' found up vote -2 down vote syntax error favorite I have a problem with my Pascal code. There is some error and I don´t know where. program GTA6; uses Crt; var obraz, x, mampistoli, mamnuz: Integer; begin clrscr; randomize; obraz := 1; repeat clrscr; if obraz = 1 then begin writeln('Je 9:00 rano. Probudis se ve svem byte. Nekdo ti zvoni na dvere. Pujdes otevrit(2) nebo budes zvonek ignorovat(3)?'); readln(obraz); if (obraz <> 2) and (obraz <> fatal syntax error 3) then obraz := 1; end else if obraz = 2 then begin writeln('Otevres dvere a jsou tam dva dvoumetrovy plesaty chlapi s pistolema v ruce. Prej dluzis jejich sefoj 200 000 Kc a chce je vratit do 19:00 jinak te prijdou zabit.'); writeln(' Sahnout po pistoli(4), nedelat nic (5)'); readln(obraz); if (obraz <> 2) and (obraz <> 3) and (obraz <> 4) and (obraz<> 5) then obraz := 2; end else if obraz = 5 then begin if mampistoli <> 1 then begin writeln('Odesli. Ty zjistis, ze nemas 200 000.'); writeln('vzit si pistoli(1), nebo si vzit nuz(2)'); readln(x); if x = 1 then mampistoli := 1; if x = 2 then mamnuz := 1; end; writeln('Takhle narychlo tolik penez nesezenes...budes muset udelat banku, nebo tak neco.'); writeln('Vyloupit banku (6), trafiku (7), vykr st auto (8)'); readln(obraz); if (obraz <> 6) and (obraz <> 7) and (obraz <> 8) then obraz := 5; end else if obraz = 6 then begin if mampistoli = 1 then begin writeln('Rozhodl jsi se vyloupit banku s pistoli.'); writeln('Hlidac videl tvoji zbran a vystrelil po tobe!'); x := random(100); if x < 50 then writeln('Trefil te primo do hlavy!'); writeln('Zemrel jsi!'); obraz := 0; end; until obraz = 0; writeln('KONEC HRY