The declaration of the type is:

type
  TMediaLibrary = record
    Title:string[30];
    TrackNo:integer;
    Artist:string[30];
    Album:string[30];
    Year:string[4];
    Genre:string[30];
    Comment:String[30];
    Directory:string;
  end; 

var  SongInfo: TMediaLibrary;

and the file implementation of it is here:

procedure TForm1.Button1Click(Sender: TObject);
var
  SongFile:string;
  MediaLibrary: file of TMediaLibrary; <<<Error is here
begin
.
.
.
.
  AssignFile(MediaLibrary, 'C:\Program Files\toMedia Player\data\libr.db');
  rewrite(MediaLibrary);
  Write(MediaLibrary, SongInfo);
  CloseFile(MediaLibrary);
end;

My problem is that when i try to compile the code it gives the error "Type TMediaLibrary needs finalization - not allowed in file type". This is my first post on any coding community site as most problems have already been solved already, but this has stumped me and google.

Thanks alot for any help.

The string (Directory) in the record is causing your problem. You'll need to change it to e.g. string[30]. string may not appear in a typed file, since it's length is undetermined.

This question has already been answered. Start a new discussion instead.