delphivirtualtreeviewdelphi-10.3-rio

Delphi 10.x "Cannot resolve unit name" for newly installed library


I encountered the following puzzling situation while installing a third-party library, in this case Virtual Treeview, which I will use as an example herein.

After following the installation procedure from INSTALL.txt, the new components appeared in Delphi's component palette, and can be added to a form.

However, building one of the supplied example projects, in this case "Minimal" fails, saying:

'Cannot resolve unit name "VirtualTrees" at line xxx', which is the uses statement in which VirtualTrees is listed.

Congruent with that symptom, in the source code editor, (uses) VirtualTrees, and subsidiary component declarations, were marked with red squiggles, indicating identifier undeclared or not resolved.

The supplied demo project was set to target Windows 32. But puzzlingly, if I switch the target to Windows 64, it will compile.

Installation consisted of:

  1. Unzip the supplied zip file to wherever you locate source packages.

  2. In Delphi, open the project group: File > Open .... VirtualTreeView.groupproj

  3. Once loaded, in the project tree, right click on VirtualTreesD26.bpl > Install.

  4. Add VirtualTreeView's "Source" folder to the Library Path, using "Tools > Options > Language > Delphi Options > Library > Library Path > [...]"

What's allowing the IDE to know about the component, but then failure to compile for Windows 32, yet success for Windows 64?


Solution

  • Each target has its own library path. You have added the VT paths to the Win64 target, but need to do the same for the Win32 target.

    Alternatively, remove the VT paths from the Win64 target search path, and add them instead to the target that applies to all projects, and then they will be inherited by the other projects.

    In the options dialog there is a drop down control that allows you to specify the target to which your settings are to be applied.