This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ed: When libvector.a is processed, Í is empty, so no member object ﬁles from libvector.a are added to . Thus the reference to addvec is never resolved, and the linker emits an error message and terminates.. The general rule for libraries is to place them at the end of the command line. If the members of the different libraries are independent, in that no member references a symbol deﬁned by another member, then the libraries can be placed at the end of the command line in any order. On the other hand, if the libraries are not independent, then they must be ordered so that for each symbol × that is referenced externally by a member of an archive, at least one deﬁnition of × follows a reference to × on the command line. For example, suppose foo.c calls functions in libx.a and libz.a that call functions in liby.a. Then libx.a and libz.a must precede liby.a on the command line:
unix> gcc foo.c libx.a libz.a liby.a Libraries can be repeated on the command line if necessary to satisfy the dependence requirements. Fo...
View Full Document