X1033 Unit '%s' implicitly imported into package '%s' (Object Pascal)

From Appmethod Topics
Jump to: navigation, search

Go Up to Error and Warning Messages (Object Pascal) Index

The unit specified was not named in the contains clause of the package, but a unit which has already been included in the package imports it.

This message will help the programmer avoid violating the rule that a unit may not reside in more than one related package.

Ignoring the warning, will cause the unit to be put into the package. You could also explicitly list the named unit in the contains clause of the package to accomplish the same result and avoid the warning altogether. Or, you could alter the package list to load the named unit from another package.


package Produce;
  contains Classes;
end.

In the above program, Classes uses (either directly or indirectly) 'consts', 'TypInfo', and 'SysUtils'. We will get a warning message for each of these units.


package Solve;
  contains consts, TypInfo, SysUtils, Classes;
end.

The best solution for this problem is to explicitly name all the units which will be imported into the package in the contains clause, as has been done here.

See Also