Error:(6, 15) Pascal builder: Identifier not found "class"

Issue #27 closed
Daniel Roziecki created an issue

Hi,

I created test project.

SDK is FreePascal 3.0 directory src is "Source folder"

I added simple test.pas file with:

unit Test;

interface

type
    TParent = class
        procedure DoSomething;
    end;

    TChild = class(TParent)
        procedure DoSomething; override;
    end;

implementation

{ TParent }

procedure TParent.DoSomething;
begin
end;

procedure TChild.DoSomething;
begin

end;

end.

And I can't compile it.

Information:Pascal builder: Compiler family:FPC Information:Pascal builder: Compiler command: C:\FPC\3.0.0\bin\i386-win32\fpc.exe -viewnb -FEC:\work\src\projects\fpc\untitled\out\production\untitled -FuC:\work\src\projects\fpc\untitled.idea -FiC:\work\src\projects\fpc\untitled.idea -FuC:\work\src\projects\fpc\untitled\src -FiC:\work\src\projects\fpc\untitled\src -FuC:\work\src\projects\fpc\untitled -FiC:\work\src\projects\fpc\untitled -FuC:\FPC\3.0.0\units\i386-win32\rtl-objpas -FiC:\FPC\3.0.0\units\i386-win32\rtl-objpas -FuC:\FPC\3.0.0\units\i386-win32\rtl -FiC:\FPC\3.0.0\units\i386-win32\rtl -FuC:\FPC\3.0.0\units\i386-win32\regexpr -FiC:\FPC\3.0.0\units\i386-win32\regexpr -dMSWINDOWS -dCPUX86 C:\work\src\projects\fpc\untitled\src\test.pas (Module: untitled) Information:Pascal builder: Information:Pascal builder: Free Pascal Compiler version 3.0.0 [2015/11/16] for i386 Information:Pascal builder: Copyright (c) 1993-2015 by Florian Klaempfl and others Information:Pascal builder: Target OS: Win32 for i386 Information:Pascal builder: Compiling C:\work\src\projects\fpc\untitled\src\test.pas Information:17.12.2016 21:41 - Compilation completed with 3 errors and 3 warnings in 1s 431ms Warning:Pascal builder: Compilation aborted Warning:Pascal builder: C:\FPC\3.0.0\bin\i386-win32\ppc386.exe returned an error exitcode Warning:Pascal builder: Error. Compiler exit code: 1 C:\work\src\projects\fpc\untitled\src\test.pas Error:(6, 15) Pascal builder: Identifier not found "class" Error:(7, 9) Pascal builder: Error in type definition Error:(7, 9) Pascal builder: Syntax error, ";" expected but "PROCEDURE" found

Intellij Idea Utlimate 2016.3.1, Windows 10

Regards

Daniel Roziecki

Comments (4)

  1. George Bakhtadze repo owner

    The code can't be compiled because it's incorrect: in default compatibility mode of FPC there is no reserved word "class".

    To change the mode add {$MODE OBJFPC} as the first line. Another problem - TChild.DoSomething method marker as "override". In order to override a method you should mark the method in ancestor class as "virtual".

  2. Daniel Roziecki reporter

    Hi,

    in default compatibility mode of FPC there is no reserved word "class".

    didn't know that, thanks for info, in every example at Wiki is "class".

    Another problem - TChild.DoSomething method marker as "override". In order to override a method you should mark the method in ancestor class as "virtual".

    Ofc, it should, I didn't analyze this code, I simple copy it and paste from another issue at this forum :)

    I have a large project (+- 200k lines of code) which I want move from Kylix to FreePascal, is this addon stable enough for do it?

  3. Log in to comment