[英]I can't link static library with cmake
I try to link X11, giblib as static library with cmake. 我尝试将X11,giblib作为静态库与cmake链接。
So I append this code in CMakeLists.txt 所以我将此代码附加在CMakeLists.txt中
set(BUILD_SHARED_LIBS FALSE)
set(CMAKE_EXE_LINKER_FLAGS '-static')
target_link_libraries(Printmade2 Imlib2)
target_link_libraries(Printmade2 /usr/lib/i386-linux-gnu/libX11.a)
target_link_libraries(Printmade2 /usr/lib/libgiblib.a)
After execute 'make', this message appears. 执行“ make”后,出现此消息。
/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/../../../libX11.a(OpenDis.o): In function `OutOfMemory':
(.text+0x459): undefined reference to `xcb_disconnect'
/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/../../../libX11.a(OpenDis.o): In function `XOpenDisplay':
(.text+0x8f5): undefined reference to `xcb_get_setup'
/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/../../../libX11.a(OpenDis.o): In function `XOpenDisplay':
(.text+0xedb): undefined reference to `xcb_get_maximum_request_length'
/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/../../../libX11.a(xcb_disp.o): In function `_XConnectXCB':
(.text+0x176): undefined reference to `xcb_parse_display'
/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/../../../libX11.a(xcb_disp.o): In function `_XConnectXCB':
(.text+0x1d7): undefined reference to `xcb_connect_to_display_with_auth_info'
/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/../../../libX11.a(xcb_disp.o): In function `_XConnectXCB':
(.text+0x1f5): undefined reference to `xcb_get_file_descriptor'
...
/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/../../../libX11.a(ClDisplay.o): In function `XCloseDisplay':
(.text+0xbd): undefined reference to `xcb_disconnect'
collect2: ld returned 1 exit status
I guess something is missded, so I should link something more 我想有些东西遗漏了,所以我应该再链接些东西
but I can't find .o file in my file system. 但我在文件系统中找不到.o文件。
(For example, OpenDis.o, xcb_disp.o, ClDisplay.o) (例如,OpenDis.o,xcb_disp.o,ClDisplay.o)
What should I do to solve this problem? 我该怎么做才能解决这个问题?
It looks like you're missing the libxcb static libraries. 看来您缺少libxcb静态库。 http://xcb.freedesktop.org/ http://xcb.freedesktop.org/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.