/usr/local/lib/libgtk-x11-2.0.a(gtkcontainer.o): In function `chain_widget_destroyed':
/home/hua/gtk+-2.8.20/gtk/gtkcontainer.c:2068: undefined reference to `g_object_get_data'
以下是我尝试过的解决方案:
1.把所有的库写两遍,比如说/usr/local/lib/libhighgui.a ... /usr/lib/libpthread.a /usr/local/lib/libhighgui.a ... /usr/lib/libpthread.a
2.编译及链接时将gcc改成g++,将.c改.cpp,以及组合尝试。
3.将所有可能用到的库及可能用到的include都指定了一遍。
4. 在/etc/profile中,加入C_INCLUDE_PATH(gcc头文件路径)、 LIBRARY_PATH(静态库路径)、CPLUS_INCLUDE_PATH(g++头文件路径)变量,将我可能用的路径都加入其中。
结果,错误都是一样的。
我查了下,“g_object_get_data”在/usr/local/include/glib-2.0/gobject/gobject.h里面,按理说,它所在库文件应该在/usr/local/lib/libgobject-2.0.a中,但奇怪的是:
# objdump -S libgobject-2.0.so | grep g_object_get_data
g_object_get_data (GObject *object,
* carray = g_object_get_data (object, "GObject-closure-array");
0000cb20 <IA__g_object_get_data>:
cb42: 74 0b je cb4f <IA__g_object_get_data+0x2f>
cb48: 74 05 je cb4f <IA__g_object_get_data+0x2f>
cb4d: 74 14 je cb63 <IA__g_object_get_data+0x43>
cb61: 74 21 je cb84 <IA__g_object_get_data+0x64>
cb65: 74 5c je cbc3 <IA__g_object_get_data+0xa3>
cb73: 75 3b jne cbb0 <IA__g_object_get_data+0x90>
cba8: eb cb jmp cb75 <IA__g_object_get_data+0x55>
cbc1: eb b2 jmp cb75 <IA__g_object_get_data+0x55>
cbc9: eb bf jmp cb8a <IA__g_object_get_data+0x6a>
# objdump -S libgobject-2.0.a | grep g_object_get_data
为什么libgobject-2.0.so 有输出,而libgobject-2.0.a没有输出呀,难道g_object_get_data不在libgobject-2.0.a 中,只在libgobject-2.0.so 中吗?
这可如何事好?有人呀,帮帮我吧。
5 个解决方案
#1
我的Makefile文件如下:
INCLUDEPATH+= -I/usr/local/include \
-I/usr/local/include/opencv \
-I/usr/local/lib/gtk-2.0/include \
-I/usr/local/include/gtk-2.0 \
-I/usr/local/include/gtk-2.0/gtk \
-I/usr/local/include/gtk-2.0/gdk \
-I/usr/local/include/gtk-2.0/gdk-pixbuf \
-I/usr/local/include/gtk-2.0/gdk-pixbuf-xlib \
-I/usr/local/include/glib-2.0 \
-I/usr/local/lib/glib-2.0/include \
-I/usr/local/include/glib-2.0/gobject \
-I/usr/local/include/glib-2.0/glib \
-I/usr/local/include/atk-1.0/atk \
-I/usr/local/include/libxml2/libxml \
-I/usr/local/include/pixman-1 \
-I/usr/local/include/libpng12 \
-I/usr/local/include/freetype2/freetype \
-I/usr/local/include/freetype2/freetype/config \
-I/usr/local/include/cairo \
-I/usr/local/include/pango-1.0/pango \
-I/usr/local/include/fontconfig \
-I/usr/include/jasper
LIBS+= -Xlinker --start-group \
/usr/local/lib/libhighgui.a \
/usr/local/lib/libcv.a \
/usr/local/lib/libcxcore.a \
/usr/local/lib/libcvaux.a \
/usr/local/lib/libml.a \
/usr/local/lib/libgtk-x11-2.0.a \
/usr/local/lib/libpango-1.0.a \
/usr/local/lib/libgdk-x11-2.0.a \
/usr/local/lib/libcairo.a \
/usr/local/lib/libgobject-2.0.a \
/usr/lib/libjasper.a \
/usr/local/lib/libglib-2.0.a \
/usr/local/lib/libgthread-2.0.a \
/usr/local/lib/libpng.a \
/usr/local/lib/libjpeg.a \
/usr/local/lib/libtiff.a \
/usr/lib/libpthread.a \
/usr/local/lib/libhighgui.a \
/usr/local/lib/libcv.a \
/usr/local/lib/libcxcore.a \
/usr/local/lib/libcvaux.a \
/usr/local/lib/libml.a \
/usr/local/lib/libgtk-x11-2.0.a \
/usr/local/lib/libpango-1.0.a \
/usr/local/lib/libgdk-x11-2.0.a \
/usr/local/lib/libcairo.a \
/usr/local/lib/libgobject-2.0.a \
/usr/lib/libjasper.a \
/usr/local/lib/libglib-2.0.a \
/usr/local/lib/libgthread-2.0.a \
/usr/local/lib/libpng.a \
/usr/local/lib/libjpeg.a \
/usr/local/lib/libtiff.a \
/usr/lib/libpthread.a \
-Xlinker --end-group
facedect:facedect.o
gcc $(INCLUDEPATH) -o facedect facedect.o $(LIBS)
facedect.o:facedect.c facedect.h
gcc $(INCLUDEPATH) -c facedect.c facedect.h
INCLUDEPATH+= -I/usr/local/include \
-I/usr/local/include/opencv \
-I/usr/local/lib/gtk-2.0/include \
-I/usr/local/include/gtk-2.0 \
-I/usr/local/include/gtk-2.0/gtk \
-I/usr/local/include/gtk-2.0/gdk \
-I/usr/local/include/gtk-2.0/gdk-pixbuf \
-I/usr/local/include/gtk-2.0/gdk-pixbuf-xlib \
-I/usr/local/include/glib-2.0 \
-I/usr/local/lib/glib-2.0/include \
-I/usr/local/include/glib-2.0/gobject \
-I/usr/local/include/glib-2.0/glib \
-I/usr/local/include/atk-1.0/atk \
-I/usr/local/include/libxml2/libxml \
-I/usr/local/include/pixman-1 \
-I/usr/local/include/libpng12 \
-I/usr/local/include/freetype2/freetype \
-I/usr/local/include/freetype2/freetype/config \
-I/usr/local/include/cairo \
-I/usr/local/include/pango-1.0/pango \
-I/usr/local/include/fontconfig \
-I/usr/include/jasper
LIBS+= -Xlinker --start-group \
/usr/local/lib/libhighgui.a \
/usr/local/lib/libcv.a \
/usr/local/lib/libcxcore.a \
/usr/local/lib/libcvaux.a \
/usr/local/lib/libml.a \
/usr/local/lib/libgtk-x11-2.0.a \
/usr/local/lib/libpango-1.0.a \
/usr/local/lib/libgdk-x11-2.0.a \
/usr/local/lib/libcairo.a \
/usr/local/lib/libgobject-2.0.a \
/usr/lib/libjasper.a \
/usr/local/lib/libglib-2.0.a \
/usr/local/lib/libgthread-2.0.a \
/usr/local/lib/libpng.a \
/usr/local/lib/libjpeg.a \
/usr/local/lib/libtiff.a \
/usr/lib/libpthread.a \
/usr/local/lib/libhighgui.a \
/usr/local/lib/libcv.a \
/usr/local/lib/libcxcore.a \
/usr/local/lib/libcvaux.a \
/usr/local/lib/libml.a \
/usr/local/lib/libgtk-x11-2.0.a \
/usr/local/lib/libpango-1.0.a \
/usr/local/lib/libgdk-x11-2.0.a \
/usr/local/lib/libcairo.a \
/usr/local/lib/libgobject-2.0.a \
/usr/lib/libjasper.a \
/usr/local/lib/libglib-2.0.a \
/usr/local/lib/libgthread-2.0.a \
/usr/local/lib/libpng.a \
/usr/local/lib/libjpeg.a \
/usr/local/lib/libtiff.a \
/usr/lib/libpthread.a \
-Xlinker --end-group
facedect:facedect.o
gcc $(INCLUDEPATH) -o facedect facedect.o $(LIBS)
facedect.o:facedect.c facedect.h
gcc $(INCLUDEPATH) -c facedect.c facedect.h
#2
看到了GTK好像不可以静态编译吧,它依赖的库必要的就有5,6个,而且只有部分是可以静态编译的。
#3
可我个都产生了.a文件。
#4
mark ....
#5
实在不行,如果库里面你用到的函数耦合性不大的话,直接拿出来用吧
#1
我的Makefile文件如下:
INCLUDEPATH+= -I/usr/local/include \
-I/usr/local/include/opencv \
-I/usr/local/lib/gtk-2.0/include \
-I/usr/local/include/gtk-2.0 \
-I/usr/local/include/gtk-2.0/gtk \
-I/usr/local/include/gtk-2.0/gdk \
-I/usr/local/include/gtk-2.0/gdk-pixbuf \
-I/usr/local/include/gtk-2.0/gdk-pixbuf-xlib \
-I/usr/local/include/glib-2.0 \
-I/usr/local/lib/glib-2.0/include \
-I/usr/local/include/glib-2.0/gobject \
-I/usr/local/include/glib-2.0/glib \
-I/usr/local/include/atk-1.0/atk \
-I/usr/local/include/libxml2/libxml \
-I/usr/local/include/pixman-1 \
-I/usr/local/include/libpng12 \
-I/usr/local/include/freetype2/freetype \
-I/usr/local/include/freetype2/freetype/config \
-I/usr/local/include/cairo \
-I/usr/local/include/pango-1.0/pango \
-I/usr/local/include/fontconfig \
-I/usr/include/jasper
LIBS+= -Xlinker --start-group \
/usr/local/lib/libhighgui.a \
/usr/local/lib/libcv.a \
/usr/local/lib/libcxcore.a \
/usr/local/lib/libcvaux.a \
/usr/local/lib/libml.a \
/usr/local/lib/libgtk-x11-2.0.a \
/usr/local/lib/libpango-1.0.a \
/usr/local/lib/libgdk-x11-2.0.a \
/usr/local/lib/libcairo.a \
/usr/local/lib/libgobject-2.0.a \
/usr/lib/libjasper.a \
/usr/local/lib/libglib-2.0.a \
/usr/local/lib/libgthread-2.0.a \
/usr/local/lib/libpng.a \
/usr/local/lib/libjpeg.a \
/usr/local/lib/libtiff.a \
/usr/lib/libpthread.a \
/usr/local/lib/libhighgui.a \
/usr/local/lib/libcv.a \
/usr/local/lib/libcxcore.a \
/usr/local/lib/libcvaux.a \
/usr/local/lib/libml.a \
/usr/local/lib/libgtk-x11-2.0.a \
/usr/local/lib/libpango-1.0.a \
/usr/local/lib/libgdk-x11-2.0.a \
/usr/local/lib/libcairo.a \
/usr/local/lib/libgobject-2.0.a \
/usr/lib/libjasper.a \
/usr/local/lib/libglib-2.0.a \
/usr/local/lib/libgthread-2.0.a \
/usr/local/lib/libpng.a \
/usr/local/lib/libjpeg.a \
/usr/local/lib/libtiff.a \
/usr/lib/libpthread.a \
-Xlinker --end-group
facedect:facedect.o
gcc $(INCLUDEPATH) -o facedect facedect.o $(LIBS)
facedect.o:facedect.c facedect.h
gcc $(INCLUDEPATH) -c facedect.c facedect.h
INCLUDEPATH+= -I/usr/local/include \
-I/usr/local/include/opencv \
-I/usr/local/lib/gtk-2.0/include \
-I/usr/local/include/gtk-2.0 \
-I/usr/local/include/gtk-2.0/gtk \
-I/usr/local/include/gtk-2.0/gdk \
-I/usr/local/include/gtk-2.0/gdk-pixbuf \
-I/usr/local/include/gtk-2.0/gdk-pixbuf-xlib \
-I/usr/local/include/glib-2.0 \
-I/usr/local/lib/glib-2.0/include \
-I/usr/local/include/glib-2.0/gobject \
-I/usr/local/include/glib-2.0/glib \
-I/usr/local/include/atk-1.0/atk \
-I/usr/local/include/libxml2/libxml \
-I/usr/local/include/pixman-1 \
-I/usr/local/include/libpng12 \
-I/usr/local/include/freetype2/freetype \
-I/usr/local/include/freetype2/freetype/config \
-I/usr/local/include/cairo \
-I/usr/local/include/pango-1.0/pango \
-I/usr/local/include/fontconfig \
-I/usr/include/jasper
LIBS+= -Xlinker --start-group \
/usr/local/lib/libhighgui.a \
/usr/local/lib/libcv.a \
/usr/local/lib/libcxcore.a \
/usr/local/lib/libcvaux.a \
/usr/local/lib/libml.a \
/usr/local/lib/libgtk-x11-2.0.a \
/usr/local/lib/libpango-1.0.a \
/usr/local/lib/libgdk-x11-2.0.a \
/usr/local/lib/libcairo.a \
/usr/local/lib/libgobject-2.0.a \
/usr/lib/libjasper.a \
/usr/local/lib/libglib-2.0.a \
/usr/local/lib/libgthread-2.0.a \
/usr/local/lib/libpng.a \
/usr/local/lib/libjpeg.a \
/usr/local/lib/libtiff.a \
/usr/lib/libpthread.a \
/usr/local/lib/libhighgui.a \
/usr/local/lib/libcv.a \
/usr/local/lib/libcxcore.a \
/usr/local/lib/libcvaux.a \
/usr/local/lib/libml.a \
/usr/local/lib/libgtk-x11-2.0.a \
/usr/local/lib/libpango-1.0.a \
/usr/local/lib/libgdk-x11-2.0.a \
/usr/local/lib/libcairo.a \
/usr/local/lib/libgobject-2.0.a \
/usr/lib/libjasper.a \
/usr/local/lib/libglib-2.0.a \
/usr/local/lib/libgthread-2.0.a \
/usr/local/lib/libpng.a \
/usr/local/lib/libjpeg.a \
/usr/local/lib/libtiff.a \
/usr/lib/libpthread.a \
-Xlinker --end-group
facedect:facedect.o
gcc $(INCLUDEPATH) -o facedect facedect.o $(LIBS)
facedect.o:facedect.c facedect.h
gcc $(INCLUDEPATH) -c facedect.c facedect.h
#2
看到了GTK好像不可以静态编译吧,它依赖的库必要的就有5,6个,而且只有部分是可以静态编译的。
#3
可我个都产生了.a文件。
#4
mark ....
#5
实在不行,如果库里面你用到的函数耦合性不大的话,直接拿出来用吧