Problem with linking in gcc

Posted by chitra on Stack Overflow See other posts from Stack Overflow or by chitra
Published on 2010-05-28T16:27:04Z Indexed on 2010/05/28 16:32 UTC
Read the original article Hit count: 271

Filed under:

I am compiling a program in which a header file is defined in multiple places. Contents of each of the header file is different, though the variable names are the same internal members within the structures are different .

Now at the linking time it is picking up from a library file which belongs to a different header not the one which is used during compilation. Due to this I get an error at link time.

Since there are so many libraries with the same name I don't know which library is being picked up. I have lot of oems and other customized libraries which are part of this build.

I checked out the options in gcc which talks about selecting different library files to be included. But no where I am able to see an option which talks about which libraries are being picked up the linker.

If the linker is able to find more than one library file name, then which does the linker pick up is something which I am not able to understand. I don't want to specify any path, rather I want to understand how the linker is resolving the multiple libraries that it is able to locate. I tried putting -v option, but that doesn't list out the path from which the gcc picks up the library.

I am using gcc on linux.

Any help in this regard is highly appreciated.

Regards, Chitra

© Stack Overflow or respective owner

Related posts about gcc