Re: [Gc] Compiling and linking
ivmai at mail.ru
Sun Nov 16 23:36:36 PST 2008
"Suzanne Sirois" <suzanne.sirois at gmail.com> wrote:
> in the example of compiling and linking
> cc -I/home/xyz/gc/include loop.c /home/xyz/gc/lib/libgc.a -o loop
For simplicity this could be re-written to have to phases:
cc -I/home/xyz/gc/include -c loop.c
cc -o loop loop.o /home/xyz/gc/lib/libgc.a
For Your "multi-file" app this could be expressed as:
cc -I/home/xyz/gc/include <other_options> -c file1.c
cc -I/home/xyz/gc/include <other_options> -c fileN.c
cc -o <your_app_filename> file1.o ... fileN.o /home/xyz/gc/lib/libgc.a
I assume You understand that file1.c .. fileN.c are your "many files *.c".
Hope this helps You.
> it contains only one file: loop.c
> But I have a program with many files *.c and *.h and also a Makefile
> how do I link my program with GC?
For makefiles You should insert "-I/home/xyz/gc/include" and "/home/xyz/gc/lib/libgc.a" in the appropriate places.
It seems (to me) You'd better study some book (don't ask me which) about C compiling, linking and make files.
> Best regards
More information about the Gc