How to do intremental linking with gcc and ld

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a top-level directory from which I want to share as common code
with two different applications (a client and a server).  I thought it
would be quite easy to create a combined object file in the common
directory and then link to it from each of the individual programs.
While I don't have any problem compiling the larger common object
file, I have having unresolved symbols (to shared libraries like glib
and libmysql)  when I try to link the two
different programs to it.

Here is how I am creating the common object file:

 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.

Thank in advance to anyone who helps.

-- 
Bryan
<><

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux