Search code examples
delphidelphi-7

Cannot load package: it contains unit which is also contained in another package


I am developing a Delphi 7 application with MDI child forms in packages. I use common units (for example Zlib to compressing and decompressing) in some packages. I load the first group of packages and its form1 (which contains zlib, used in the uses section), and when I load the second group of packages with the same condition (form2 which contains zlib) while the first packages are loaded, I get the error "Cannot load package A it contains unit 'UtilityPasZlib' which is also contained in package B."

I read some articles; they suggest using the UtilityPasZlib in the requires section, but I dont know how to do this.

How can I solve this problem?

Thanks


Solution

  • Units may not appear in two or more different packages that are loaded into the same program. In your situation, you must move the shared units into a separate package that is used by your other existing packages.

    It's not obvious to me what UtilityPasZlib is, but perhaps you don't need it. After all, Delphi 7 ships with a ZLib unit.