KingOfKong
KingOfKong

Reputation: 279

Adding components to a component folder

I'm working on a Delphi project and I want to add a parser to it. The parser comes with components that should be added to the project

So it works great if I add the files to the same folder that my project is in, but I would like it to be in a separate components folder (to keep it cleaner, since I'm not going to be modifying those files anyway).

However, when I add create a components folder and add the files there, when I add it to the project through delphi, it has trouble finding the files. So it adds the .psu files to the right folder, but it says it can't find the unit 'Calculator', for example, until I copy the Calculator.dcu file from the component directory to the source directory.

How do I tell Delphi to look for those files where I put them?

Thanks

Upvotes: 1

Views: 1459

Answers (2)

Fabricio Araujo
Fabricio Araujo

Reputation: 3820

You have some options:

  • Add the units folder to the Projects' Search Path (Menu: Project\Options...) - only affects the project you're working now.
  • Add the units folder to the Environment's Library Path (Menu: Tools\Options...\Environment Options\Delphi Options\Library - Win32) if you want all projects in this ide install to find that units (not only the project you are working).
  • Just to complement: if, in the near future, you add components to your pallete and the compilation fail not finding the units; you'll have to update your system path as well. For details give a search on SO on this, as this is a common source of questions on the delphi tag... ;-)

Upvotes: 3

Rudy Velthuis
Rudy Velthuis

Reputation: 28806

Take a look at the Search Path for the project in the project options. Make sure your .pas and/or .dcu files are in that search path, i.e. add the folder in which the units are to your project's search path.

Upvotes: 1

Related Questions