I have a static library, libxbgi.a. When I want to properly link a program with this library I have to write: gcc prog.c -o prog -lm -L /usr/X11R6/lib -lX11 -L. -lxbgi It is cumbersome to write such a long command line. Is it possible to pre-link the libX11.a and libm.a with libxbgi.a, so that the command line will read: gcc prog.c -o prog -L. -lxbgi.a
I know both are acceptable solutions, but what I'm looking is for the library libxbgi.a itself to contain the linked object codes from libX11.a and libm.a
Kinda something like this: gcc -<the magic flag> -c *.c -L /usr/X11R6/lib -lX11 -lm (*.c contain codes for libxbgi.a) ar rc libxbgi.a *.o Then users can link their files using just: gcc prog.c -o prog -L -lxbgi I know it seems impossible, and maybe is too, but I thought if it is possible someone here would know it...
>I know it seems impossible
What it seems is stupid. But since you insist on doing something stupid, for probably a stupid reason, you can unpack both libraries and repack them using ar.
Well the reason is that I want "users" to be able to compile their code with my library without needing lots of compiler options... yeah, thats stupid. Another reason is that the location of libX11.a is not standard.
Anyway I think I can use ar to unpack and repack the libraries :$.
Thanks and cheers!!