Recent

Author Topic: "IMPLEMENTATION" expected  (Read 13927 times)

BrainChemistry

  • Jr. Member
  • **
  • Posts: 79
"IMPLEMENTATION" expected
« on: January 18, 2008, 11:42:43 pm »
Just started my first Lazarus project (experienced with FP though) and after some building of the form.... suddenly a strange messege: MainUnit.pas(15,3) Fatal: Syntax error, "IMPLEMENTATION" expected but "identifier TMAINFORM" found.


Code: [Select]
unit MainUnit;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Menus,
  StdCtrls, ExtCtrls;



  { TMainForm }

  TMainForm = class(TForm)
    ButtonRefresh: TButton;
    ComboBoxGames: TComboBox;
    LabelChooseGame: TLabel;
    MainMenu1: TMainMenu;
    MenuFile: TMenuItem;
    MenuClose: TMenuItem;
    MenuEdit: TMenuItem;
    MenuItemRefreshGameList: TMenuItem;
    procedure ComboBox1Click(Sender: TObject);
    procedure ComboBoxGamesClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure MenuCloseClick(Sender: TObject);
    procedure MenuItemRefreshGameListClick(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;



var
  MainForm: TMainForm;

implementation



{ TMainForm }

procedure TMainForm.MenuCloseClick(Sender: TObject);
begin
  close;
end;

procedure TMainForm.MenuItemRefreshGameListClick(Sender: TObject);
begin
  RefreshGameListProc;
end;


initialization
  {$I mainunit.lrs}

end.


I should mention that proc. RefreshGameListProc is defined and even if I comment it out the error occurs.

EDIT: v0.9.25 Beta btw.

Zaher

  • Hero Member
  • *****
  • Posts: 680
    • parmaja.org
RE: "IMPLEMENTATION" expected
« Reply #1 on: January 19, 2008, 12:15:39 am »
You removed Type before TMainForm

Code: [Select]

Type

  { TMainForm }

  TMainForm = class(TForm)


and you have some procedures not implementation section , remove it.

BrainChemistry

  • Jr. Member
  • **
  • Posts: 79
"IMPLEMENTATION" expected
« Reply #2 on: January 19, 2008, 02:29:46 am »
Damn, you are right   :roll: ... Thanks alot for the fast reply, zaher!

Btw. about the removal of procedures in implementation part... I remember from school days (many years ago) that in Delphi the unused procedures accidently created got removed automatically when compiling. Why Lazarus isn't doing this? Is there an option to imitate this behaviour?

Zaher

  • Hero Member
  • *****
  • Posts: 680
    • parmaja.org
"IMPLEMENTATION" expected
« Reply #3 on: January 19, 2008, 03:06:13 am »
With your code Delphi not remove the unimplemented procedures, it just remove empty procedures when saving.
BTW i think Delphi started to challenge VB, so it is makd for lazy developers :)

 

TinyPortal © 2005-2018