Skip to content

bug? if missing extension in included dotted file name.

Tested on fpc 3.2.2 and trunk 3.3.1

When we use an include file with dots in the name and without a supported include file extension (.inc, .pp, .pas) , the compiler can't found it and the following code doesn't compile. Related to #41061 (closed)

As the documentacion says:

If the file with the given filename exists, it will be included. If no extension is given, the compiler will append the .pp extension to the file and try with that filename. No other extensions are tried.

Also note that this documentation is inacurate. The compiler tries the '.inc', '.pp', and '.pas' extensions.

The attached patch is my proposal to solve this issue. I Know that if dotted file names are not supported then this is not a bug and can be closed.

include.message.pp

const
  Hello = 'Hello world!';

project1.lpr

program project1;
{$mode objfpc}{$H+}
uses
  {$IFDEF UNIX}
  cthreads,
  {$ENDIF}
  Classes;

{$I include.message}
begin
  writeln(Hello);
  readln;
end.

Test project: IncludeFiles.zip

BetterSupportForDottedIncludeFiles.patch

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information