Recent

Author Topic: Fatal: Syntax error, "=" expected but "CONSTRUCTOR" found  (Read 2898 times)

Bill52

  • New member
  • *
  • Posts: 8
Fatal: Syntax error, "=" expected but "CONSTRUCTOR" found
« on: August 24, 2014, 10:36:20 am »
Hi there,

The  below code produces the error:

Code: [Select]
unit myClass;

{$mode objfpc}{$H+}


interface

type
   TmyClass = class(TObject);
   public
      constructor  Create;

end;

implementation

constructor TmyClass.Create;
begin
end;

end.   

The error message:
myclass.pas(11,7) Fatal: Syntax error, "=" expected but "CONSTRUCTOR" found

Line 11 is highlighted: constructor  Create;

It's on Vista 32, Lazarus 1.2.4; fpc 2.6.4

I can't see what's wrong.
Thanks!

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: Fatal: Syntax error, "=" expected but "CONSTRUCTOR" found
« Reply #1 on: August 24, 2014, 11:02:52 am »
Remove the semicolon:
Code: [Select]
   TmyClass = class(TObject)
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Bill52

  • New member
  • *
  • Posts: 8
Re: Fatal: Syntax error, "=" expected but "CONSTRUCTOR" found
« Reply #2 on: August 24, 2014, 11:22:00 am »
Remove the semicolon:
Code: [Select]
   TmyClass = class(TObject)

DOH! Just couldn't see it.
Thanks!

 

TinyPortal © 2005-2018