This depends on the licenses.
Copyleft licenses are designed to prevent you mixing code as the licenses are generally incompatible with mixing.
More permissive license will generally allow you to mix licenses. This is why you can ship permissive code in a proprietary code base.
As for linking, “weak copyleft” license allow you to link but not to “mix” code. This is essentially the point of the LGPL.