Re: libraries
Re: libraries
- Subject: Re: libraries
- From: Philip George <email@hidden>
- Date: Mon, 21 Jul 2003 05:11:59 -0500
>
> this is ok, but it doesn't build a lib. This only builds object code.
>
> To make it a lib you have to use "ar" to make it an archive and then
>
> "ranlib" tool to make toc of the archive created.
>
>
>
> i.e. make static library from 2 files
>
>
>
> gcc2 adder.c -nostdlib -static -object -o adder.o
>
> gcc2 multiplier.c -nostdlib -static -object -o multiplier.o
>
>
These should be
>
>
gcc adder.c -c -o adder.o
>
gcc multiplier.c -c -o multiplier.o
>
>
You are trying to fight the linker, which is crazy ;-) Just tell GCC
>
not to link with the "-c" option.
>
>
Kind regards,
>
>
Alastair.
Actually, both of these approaches yielded a library, but in both cases,
after i added the library to my project, and tried to call the adder()
function, I got an "Undefined symbols: _adder" error during the link stage.
Anyone know why that might be?
Thanks for all the great input. It's getting me a lot closer, that's for
sure. :)
- Philip
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: | |
| >Re: libraries (From: "Alastair J.Houghton" <email@hidden>) |