Autor Beitrag
ggehrma
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 111

WinXP
D2005 Pers.
BeitragVerfasst: So 22.01.06 12:37 
Hallo,

Ich habe ein Record als Typ definiert. Wenn ich jetzt einer Variablen diesen Typ zuweisen will und die Variable dann verwenden will bekomme ich den Fehler [Fehler] Main.pas(85): E2018 Record, Objekt oder Klassentyp erforderlich.
Wo liegt der Fehler?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
TYPE
  TVector = RECORD
    X: Single;
    Y: Single;
    Z: Single;
  end;
...
VAR Position: TVector;

....

procedure TForm1.FormCreate(Sender: TObject);
begin
  Position.X := 0;
END;


mfg, ggehrma

_________________
"...To boldly go where no one has gone before."
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: So 22.01.06 13:55 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
... 
private
{ Private declarations }
Position: TVector;
...


so sollte es klappen ;)
andernfalls, wenn ich es so schreibe:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
...
var
  Form1: TForm1;
  Position: TVector;
implementation

{$R *.dfm}
...


bekomme ich den gleichen fehler!

Oben könntest du auch
ausblenden Delphi-Quelltext
1:
2:
3:
type
TVector = RECORD
      X,Y,Z: Single;
schreiben, bringt dir zwar nur formal was, sieht aber schöner aus, bzw der quelltext wird nicht so lang :P
ggehrma Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 111

WinXP
D2005 Pers.
BeitragVerfasst: So 22.01.06 16:18 
Funktioniert, Danke.

_________________
"...To boldly go where no one has gone before."