[fpc-devel] resource compilation fails, if cpp is not on the path

Vincent Snijders vsnijders at quicknet.nl
Thu Sep 27 13:28:50 CEST 2007

Consider the following application:

program rescomp;

{$R lazarus.rc}


If I have an empty path variable and I call the compiler with an absolute path, it 
fails, see below. The solution would be to add the --preprocessor parameter to 
windres, as is done below. The cpp.exe should be located in the same directory as 
windres. How can this be done?


D:\lazarus\bugs\rescomp>SET PATH=

D:\lazarus\bugs\rescomp>d:\fpc\2.3.1\bin\i386-win32\fpc rescomp.pas
Free Pascal Compiler version 2.3.1 [2007/07/12] for i386
Copyright (c) 1993-2007 by Florian Klaempfl
Target OS: Win32 for i386
Compiling rescomp.pas
Compiling resource lazarus.rc
gcc: installation problem, cannot exec `cpp': No such file or directory
d:\FPC\2.3.1\bin\i386-win32\windres.exe: no resources
rescomp.pas(6,1) Error: Error while linking
rescomp.pas(6,1) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: d:\fpc\2.3.1\bin\i386-win32\ppc386.exe returned an error exitcode (normal
  if you did not specify a source file to be compiled)

D:\lazarus\bugs\rescomp>d:\fpc\2.3.1\bin\i386-win32\windres lazarus.rc lazarus.r
gcc: installation problem, cannot exec `cpp': No such file or directory
d:\fpc\2.3.1\bin\i386-win32\windres: no resources

D:\lazarus\bugs\rescomp>d:\fpc\2.3.1\bin\i386-win32\windres --preprocessor=d:\fp
c\2.3.1\bin\i386-win32\cpp.exe lazarus.rc lazarus.res

More information about the fpc-devel mailing list