Re: Accelerators & static link



[error]

/usr/lib/libgdk_imlib.a(misc.o): In function `gdk_imlib_init':
misc.o(.text+0x1928): undefined reference to `XVisualIDFromVisual'
/usr/lib/libgdk_imlib.a(misc.o): In function `gdk_imlib_init_params':
misc.o(.text+0x3528): undefined reference to `XVisualIDFromVisual'
/usr/lib/libgdk_imlib.a(utils.o): In function `_gdk_imlib_calc_map_tables':
utils.o(.text+0x215): undefined reference to `pow'

[/error]

       I guess this is 'cause (as you told me) the order of the
       libs (or the lack of...).

       I'm using gdk_imlib.h, gtk.h & nothing else, and this is
       the complete compile line:

% gcc main.o widgets.o callbacks.o utils.o -o ds_tut -Wl,-Bstatic `gtk-config --li
bs` -lgdk_imlib

The problem is, you are asking the linker to read FIRST the gdk_imlib, and
only after that the whole bunch of libs defined in gtk-config --libs,
as a result, gdk_imlib is not finding the other libs, because you did not
indicate them yet! 

your problem should be solved just putting gdk_imlib AFTER the other libs, 
as in (as I said before, the linker starts reading from the end):

% gcc main.o widgets.o callbacks.o utils.o -o ds_tut 
-Wl,-Bstatic -lgdk_imlib `gtk-config --libs`

In dynamic compilations, this is usually not a problem, but
when compilling statically you need to figure out the right
order for your libs, at least from my own gcc experience (I guess 
the dynamic linker is more clever, I don't know ...)

Carlos




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