views:

292

answers:

1

After I ported Delphi Windows service app to FPC Linux console app I tried to port program with GUI. I installed newest Lazarus on my Windows machine and converted simple "hello world" app. One unit has form (.dfm file in Delphi). This form was converted to .lfm and .lrs files by Lazarus. But there is problem with compiling this:

windres: C:/htlib/pas/FInfo.lrs:1: syntax error
Free Pascal Compiler version 2.2.4 [2009/10/25] for i386
Copyright (c) 1993-2008 by Florian Klaempfl
Target OS: Win32 for i386
Compiling lazarus_test.lpr
...
Compiling C:\htlib\pas\FInfo.pas
Compiling resource C:\htlib\pas\FInfo.lrs
d:\lazarus\fpc\2.2.4\bin\i386-win32\windres.exe: C:/htlib/pas/FInfo.lrs:1: syntax error
C:\htlib\pas\FInfo.pas(366,1) Error: Error while linking
C:\htlib\pas\FInfo.pas(366,1) Fatal: There were 1 errors compiling module, stopping

First lines of FInfo.lrs file which looks like text file (not binary as .res files):

{ This is an automatically generated lazarus resource file }

LazarusResources.Add('TfrmInfo','FORMDATA',[
  'TPF0'#8'TfrmInfo'#7 ...

In designer I can see and edit this form, so I think it was converted with success. Maybe there is something wrong with .lrs file? Shouldn't it be binary as .res files? What should I do to compile this form?

EDIT:

My .pas unit has this form as:

{$R *.lrs}
+4  A: 

Remove any stray {$R *.res} or {$R *.lrs} directives.

2.2.x fpc/lazarus versions transform *.res files to .lrs files that are then included as structured constants. Adding *.res independantly produces this fail if included just below the implementation point, like in Delphi. The proper *.lrs inclusion point is in the initialization section.

Only 2.4.x (RC1 is out) will have "real" resource support base on {$R *.res}. but that will probably take a few months to trickle through (0.9.30)

Marco van de Voort
I have no {$R *.res} only {$R *.lrs} (changed from {$R *.dfm})
Michał Niklas
But it seems that ma app compiles and works when I removed {$R *.lrs}. Great!
Michał Niklas