Article View: gnu.gcc.help
Article #41438Re: gcc link problem
From: Tim Mooney
Date: Sat, 06 Apr 1996 00:00
Date: Sat, 06 Apr 1996 00:00
31 lines
2008 bytes
2008 bytes
In article <22428@828735417>, Kamlesh Rath <rathk@cs.indiana.edu> wrote: )I am trying to link several libraries (with full pathnames not using )the -lLIB option) and get an error. I have 2 libraries which call each )other (lib1.a has a function calls a function in lib2.a and vice )versa). The linker is not able to find the functions in the 2nd )library that are called by the first. Is there a way to link so that )the linker can find all the functions in both files. Sure, but the ``correct'' method depends on the platform (which you should have mentioned). For all Unix & Unix-like OSes I'm familiar with *except* AIX, if the libraries depend on each other, then the library you list first needs to also appear (again) after the library that depends on it, like: -lb1 -lb2 -lb1 Most `ld's work from left to right (AIX's doesn't), so symbols missing from `libb1.a' that are present in `libb2.a' will be taken care of with the first two `-l' statements. Then, symbols missing `libb2.a' that are present in `libb1.a' will be taken care of by the second two `-l' statements. Alternately, you could extract the necessary .o files and create a third library from the .o files that has everything you need. Tim -- Tim Mooney mooney@toons.cc.ndsu.nodak.edu Information Technology Services (701) 231-1076 (Voice) Room 242-J6, IACC Bldg. (701) 231-8541 (FAX) North Dakota State University, Fargo, ND 58105
Technical Details
Message-ID:
<4k73v1$354@golem.phys.ndsu.NoDak.edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<22428@828735417>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,e2bf3fe0da891113 X-Google-Attributes: gid11318c,public From: mooney@golem.phys.ndsu.NoDak.edu (Tim Mooney) Subject: Re: gcc link problem Date: 1996/04/06 Message-ID: <4k73v1$354@golem.phys.ndsu.NoDak.edu> X-Deja-AN: 146163340 x-disclaimer: Trust no one. references: <22428@828735417> content-type: text/plain; charset=US-ASCII organization: North Dakota Higher Education Computing Network mime-version: 1.0 newsgroups: gnu.gcc.help