[fpc-devel] Error seeking resources when copiling with {$R *.res}

NetSpirit netspirit at meta.ua
Fri Nov 4 10:46:24 CET 2016

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).

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

Demo project for this bug in attach or download here:
(Extract all files to disk; correct path to your FPC in 'compile.bat'; run
'compile.bat' two times)

More information about the fpc-devel mailing list