I
I
Interface2015-06-07 18:11:50
Delphi
Interface, 2015-06-07 18:11:50

Delphi: how to create a unit that connects additional units from a subfolder?

Perhaps a very stupid question, but how to implement the following delphi structure:
There is a project file:

//app.pas

...
uses
  unitMain.pas
...

In this case, the unitMain unit uses other modules located in the folder next to it:
//unitMain.pas

...
uses
  subUnit in '.\unitMain\subUnit.pas',
  subUnit2 in '.\unitMain\subUnit2.pas'
...

I tried to do as I wrote above, but I caught errors. It was possible to achieve the work of all this only when I rendered the construction:
//project.dpr

...
uses
  subUnit in '.\unitMain\subUnit.pas',
  subUnit2 in '.\unitMain\subUnit2.pas'
...

to the project file. While in unitMain.pas left
//unitMain.pas

...
uses
  subUnit,
  subUnit2
...

But I would like to be able to just throw the unitMain.pas file and the unitMain folder into the folder with the new project, connect this one unitMain file (which itself will connect the modules from the subfolder).
How can this be implemented? I would be very happy with an elementary example :)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Z
zed, 2015-06-07
@zedxxx

You need to set the path to the folder in the project settings: Project - Options - Delphi Compiler - Search Path
The path can be set both absolute and relative (relative to the project file).

V
Viktor Koltcov, 2015-06-08
@Vityarik

Don't waste your time with Delphi

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question