How to do intremental linking with gcc and ld

Bryan Christ bryan.christ@gmail.com
Sun Jun 21 04:35:00 GMT 2009


Thanks Tim!  I believe this is the answer I was looking for.

On Sat, Jun 20, 2009 at 5:37 PM, Tim Prince<TimothyPrince@sbcglobal.net> wrote:
> Bryan Christ wrote:
>
>>  gcc -c $(CFLAGS) $(INCLUDES) $(DEFS) *.c
>>  ld -r -o common_tools.o *.o
>>
>> And here is how I try to link against the common object file:
>>
>> gcc -c $(CFLAGS) $(INCLUDES) $(LIBS) $(NORMAL_DEFS) *.c
>> ld -o myprogram *.o ../../common/common_tools.o
>>
>> I'm sure I'm missing something trivial but don't know what that is.
>
> Your final link must take care of the library references.  You could
> substitute gcc for ld at that stage.  The .o which you made by ld -r is
> just like any other .o.
>
>



-- 
Bryan
<><



More information about the Gcc-help mailing list