Results 1 to 4 of 4

Thread: Very odd "Record, object or class type required" error

  1. #1

    Very odd "Record, object or class type required" error

    Hey guys,

    I can't get my code to compile. it says:

    [Pascal Error] n3d_shaderprogram.pas(184): E2018 Record, object or class type required
    [pascal]
    procedure Test(const a: TVector4f);
    var
    d: Single;
    begin
    d := a.x; //error here
    end;
    [/pascal]

    Defined in another unit:

    [pascal]
    PVector4f = ^TVector4f;
    TVector4f = record
    case Boolean of
    true: ( x, y, z, w: Single; );
    false: ( xyzw: array [0..3] of Single; );
    end;
    [/pascal]

    It works for TVector2f and TVector3f. Only TVector4f makes problems.

    I cant test it in Delphi 2010 because the SDL unit won't compile there (I don't think I can reproduce it by just isolating these routines... I tried that).

    I tried compiling with lazarus. But it didn't help. It gave the following error:
    G:\n3d\workingdir\src\n3d_shaderprogram.pas(184,9) Error: Illegal qualifier
    Any ideas? I'm really stuck here.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  2. #2

    Re: Very odd "Record, object or class type required" error

    I get that error sometimes from something really simple, i recompile all units and error goes away. Problem is that Lazarus didn't compile some changed unit for whatever reason. In Lazarus you can do that by adding space after any code line so it becomes "modified". 1 thing that can do that (but may not be the issue always) is in Project options -> Miscellaneous -> Always build toggled off.

    But there are always some issues with Lazarus, do you have latest daily snapshot or a very old "stable" build?

  3. #3

    Re: Very odd "Record, object or class type required" error

    A guy from another forum pointed out that this could be caused by the wrong type being used. This was actually the case.

    dglOpenGL.pas also defines a TVector4f structure. Because this unit was the last one in the uses-clause, it was overwriting the typedef from n3d_vectors.pas. That's what caused the issue.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  4. #4

    Re: Very odd "Record, object or class type required" error

    Oh yes, mouse-over hint reveals the true source type and unit it was taken from.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •