Tuesday, October 6, 2009

Cannot find resource file

Sometimes Delphi IDE gives you an error like Cannot find resource file: '%s'. Recreated.
In most cases this means that the ProjectName.res file does not exist, to be more precise if you have a Delphi project called Project1 and you get this error a file called Project1.res does not exist. This error is caused intentionally by programmers who give you a application(tutorial) source code but they delete the *.res file because it only contains the default application icon which is automatically recreated by the IDE with the up-to-date icon, for instance the Delphi 7 default application icon is different from Delphi 2010 or other Delphi version.
In other cases programmers forget to pack the *.res files in the source they upload.
When you create a new VCL Froms Application you should see something like {$R *.dfm} in a form's unit source, well if you go to main menu -> Project -> View source then you should see something like this
program Project1;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1};

{$R *.res} (* this is the way resource files are included and the default application icon in this case *)

begin
  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.

No comments:

Post a Comment

Blogroll(General programming and Delphi feeds)