Search code examples
delphidelphi-7dfm

DFM not found after reorganisation


I have a Delphi 7 project with this structure:

.dpr
foo.pas
*.pas
*.dfm
Bin/
debug/

Most of the source code, except for one file, is shared between other projects (although this is not relevant), so I did some reorganisation that looks like this:

.dpr
UniqueFile/
    foo.pas
Common/.pas
    *.pas
    *.dfm
Bin/
debug/

I changed the paths in the .dpr with the new structure, but when I try to compile for some reason it cannot find one of the .dfm files in Common folder. The error shown is:

[Error] File not found: 'SomeFile.DFM'

However, both the .pas and the corresponding .dfm are in that folder.

Did I miss some configuration?


EDIT: This file is included in the .dpr file like so:

uses
   ...
   SomeFile in 'Common/SomeFile.pas',
   ...

EDIT2: I've copied only the SomeFile.dfm file to the root folder, and it's compiling. For some reason it's still looking for that file in the old path?

EDIT3: I've included what @ken-white has pointed out but no luck. So now the .dpr looks like so:

uses
   ...
   SomeFile in 'Common/SomeFile.pas' {ChildFrame},
   ...

I've also double-checked this line in SomeFile.pas:

{$R *.DFM}

Another thing that I should point out is that the Build option works fine, but not the compiling.


Solution

  • Looks to me that your issue (at least as of now) is that you are using a forward slash instead of a backslash.

    uses
       ...
       SomeFile in 'Common/SomeFile.pas' {ChildFrame},
       ...
    

    ...should instead be...

    uses
       ...
       SomeFile in 'Common\SomeFile.pas' {ChildFrame},
       ...