Discussion:
Error seeking resources when copiling with {$R *.res}
(too old to reply)
NetSpirit
2016-11-04 09:46:24 UTC
Permalink
Raw Message
CONDITIONS
Unit file contains {$R *.res} directive. File *.res exists in the same
directory where *.pp file for unit exists.
Compiled units resides in subdirectory, for example called 'units' (-FU
command line switch).

DESCRIPTION
When project with such unit compiled first time - all work as expected.
Compiled *.ppu files goes to 'units', resulting binary created.

On the second and next compilations we encounter en error:
"Error: Can't open file 'D:\projectpath\units\Unit1.res'".

This error is a result of searching *.res in a directory where compiled
units exists, but not in a directory where unit source file resided.

FPC VERSION: FPC 3.0.0, precompiled binaries for win32, win64
OS: Windows

TEST PROJECT:
Demo project for this bug in attach or download here:
http://rgho.st/8GRBWVWcM
(Extract all files to disk; correct path to your FPC in 'compile.bat'; run
'compile.bat' two times)




_______________________________________________
fpc-devel maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Thaddy de Koning
2016-11-05 11:31:24 UTC
Permalink
Raw Message
On Fri, 4 Nov 2016 11:46:24 +0200 (EEST)
{$R *.res} in ONLY allowed for the project file.
You should never try to link in a * resource in a unit, because the *
resolves to the main project name.
Same as in Delphi.
If you need a resource in a unit, resolve the full name, like {$R
myunit1.res}
The main *.res is available over all units in a project.


"NetSpirit" <***@meta.ua>
wrote:

> CONDITIONS
> Unit file contains {$R *.res} directive. File *.res exists in the same
> directory where *.pp file for unit exists.
> Compiled units resides in subdirectory, for example called
> 'units' (-FU command line switch).
>
> DESCRIPTION
> When project with such unit compiled first time - all work as
> expected. Compiled *.ppu files goes to 'units', resulting binary
> created.
>
> On the second and next compilations we encounter en error:
> "Error: Can't open file 'D:\projectpath\units\Unit1.res'".
>
> This error is a result of searching *.res in a directory where
> compiled units exists, but not in a directory where unit source file
> resided.
>
> FPC VERSION: FPC 3.0.0, precompiled binaries for win32, win64
> OS: Windows
>
> TEST PROJECT:
> Demo project for this bug in attach or download here:
> http://rgho.st/8GRBWVWcM
> (Extract all files to disk; correct path to your FPC in
> 'compile.bat'; run 'compile.bat' two times)
>
>
>
>
> _______________________________________________
> fpc-devel maillist - fpc-***@lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

_______________________________________________
fpc-devel maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
C Western
2016-11-05 12:33:52 UTC
Permalink
Raw Message
Is {$R *.res} handled differently to {$R *.lfm}?

(My projects have lots of {$R *.lfm}


On 05/11/16 11:31, Thaddy de Koning wrote:
> On Fri, 4 Nov 2016 11:46:24 +0200 (EEST)
> {$R *.res} in ONLY allowed for the project file.
> You should never try to link in a * resource in a unit, because the *
> resolves to the main project name.
> Same as in Delphi.
> If you need a resource in a unit, resolve the full name, like {$R
> myunit1.res}
> The main *.res is available over all units in a project.
>
>
> "NetSpirit" <***@meta.ua>
> wrote:
>
>> CONDITIONS
>> Unit file contains {$R *.res} directive. File *.res exists in the same
>> directory where *.pp file for unit exists.
>> Compiled units resides in subdirectory, for example called
>> 'units' (-FU command line switch).
>>
>> DESCRIPTION
>> When project with such unit compiled first time - all work as
>> expected. Compiled *.ppu files goes to 'units', resulting binary
>> created.
>>
>> On the second and next compilations we encounter en error:
>> "Error: Can't open file 'D:\projectpath\units\Unit1.res'".
>>
>> This error is a result of searching *.res in a directory where
>> compiled units exists, but not in a directory where unit source file
>> resided.
>>
>> FPC VERSION: FPC 3.0.0, precompiled binaries for win32, win64
>> OS: Windows
>>
>> TEST PROJECT:
>> Demo project for this bug in attach or download here:
>> http://rgho.st/8GRBWVWcM
>> (Extract all files to disk; correct path to your FPC in
>> 'compile.bat'; run 'compile.bat' two times)
>>
>>
>>
>>
>> _______________________________________________
>> fpc-devel maillist - fpc-***@lists.freepascal.org
>> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>
> _______________________________________________
> fpc-devel maillist - fpc-***@lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>

_______________________________________________
fpc-devel maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
NetSpirit
2016-11-07 09:08:21 UTC
Permalink
Raw Message
I am supply {$R *.res} only as generic example. With an {$R filename.res}
the same problem.

I know this cases when compiling project:
1) Units available only in *.ppu/*.o (etc., compiled units).
== Resource, linked by {$R} in these units must be searched relative to
these compiled units.
2) Available both - source *.pp and compiled *.ppu, but *.pp unmodified,
so used *.ppu for linking.
== a) Resource, linked by {$R} in these units must be searched relative
to these compiled units.
== b) If not found - read source *.pp and search resource relative to
this *.pp.
3) Available both - source *.pp and compiled *.ppu, but *.pp modified OR
available only source *.pp and it recompiled.
== Resource, linked by {$R} in these units must be searched relative to
*.pp.

In FPC 3.0.0 approach (1) and (2a) don't work, (2a) and (3) works
partially - only the first compilation succeeded, when path's to *.res
resolved by reading source *.pp files. The next compilations fails becouse
*.res searched relative to *.ppu files, but we need put this *.res here
manually. In previous versions there is no such behavior.


> On Fri, 4 Nov 2016 11:46:24 +0200 (EEST)
> {$R *.res} in ONLY allowed for the project file.
> You should never try to link in a * resource in a unit, because the *
resolves to the main project name.
> Same as in Delphi.
> If you need a resource in a unit, resolve the full name, like {$R
myunit1.res}
> The main *.res is available over all units in a project.
>
>
> "NetSpirit"
> wrote:
>
>> CONDITIONS
>> Unit file contains {$R *.res} directive. File *.res exists in the same
directory where *.pp file for unit exists.
>> Compiled units resides in subdirectory, for example called
>> 'units' (-FU command line switch).
>> DESCRIPTION
>> When project with such unit compiled first time - all work as
>> expected. Compiled *.ppu files goes to 'units', resulting binary created.
>> On the second and next compilations we encounter en error:
>> "Error: Can't open file 'D:\projectpath\units\Unit1.res'".
>> This error is a result of searching *.res in a directory where
>> compiled units exists, but not in a directory where unit source file
resided.
>> FPC VERSION: FPC 3.0.0, precompiled binaries for win32, win64
>> OS: Windows
>> TEST PROJECT:
>> Demo project for this bug in attach or download here:
>> http://rgho.st/8GRBWVWcM
>> (Extract all files to disk; correct path to your FPC in
>> 'compile.bat'; run 'compile.bat' two times)
>> _______________________________________________
>> fpc-devel maillist - fpc-***@lists.freepascal.org
>> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>
>


_______________________________________________
fpc-devel maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
NetSpirit
2016-11-07 09:13:43 UTC
Permalink
Raw Message
Sorry, in previous letter mistake: approach (1), (2a) works, (2b) and (3)
works
partially.


_______________________________________________
fpc-devel maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Loading...