RE: [gtk-list] Static linking gtk in a program



On 12-Dec-1999 Antonio Campos wrote:
> This is not strictly a Gtk question, but here it goes in the hope of a
> response:
> 
> What parameters do I have to pass gcc to static link gtk (and gdk, and
> glib) libraries into a program?
> But I don't want to statically link X related libs, only the gtk...
> libs.
> When I use gcc myprogram.c -o myprogram `gtk-config --libs --cflags`
> -static,
> I think X libs are being included inside the binary...
> Any clues...? Thanks in advance.
> 

gcc myprogram.c -o myprogram `gtk-config --cflags --libs` /usr/lib/libglib.a\
/usr/lib/libgdk.a /usr/lib/libgtk.a /usr/lib/libgmodule.a

that should do it, I don't remember if it'll play nice with the gtk-config
script, you may have to run gtk-config and see what it does, then copy the
peices you want to your makefile or whatever. -lgtk means to dynamically link
libgtk.so, the .a files are used for static linking (called archive libraries),
so the idea is to replace the -lgtk with /usr/lib/libgtk.a

-static will statically link ALL libraries, so you're getting the X libs, libm,
libc, ...

        -Erik <erik@smluc.org> [http://math.smsu.edu/~br0ke]

The opinions expressed by me are not necessarily opinions. In all
probability, they are random rambling, and to be ignored. Failure to ignore
may result in severe boredom or confusion. Shake well before opening. Keep
Refrigerated.
        



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