我无法将静态库与 cmake 链接
I can't link static library with cmake
我尝试用cmake链接X11, giblib作为静态库。
我将这段代码添加到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)
在执行'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
我想是少了什么,所以我应该链接更多的
但是我在文件系统中找不到。o文件。
(例如,OpenDis。o, xcb_disp。o, ClDisplay.o)
我该怎么做才能解决这个问题?
看起来您错过了libxcb静态库。http://xcb.freedesktop.org/
相关文章:
- Cmake 链接问题:未定义对 Button::mousePressEvent(QGraphicsSceneMouseE
- 将 SDL2 与 CMake 链接起来
- 找不到 CMake 链接的库
- 无法将 GTest 中的类与 CMake 链接
- NDK 将库与 cmake 链接
- 无法将提升库与 CMake 链接
- 如何使用 CMake 链接"numpy/arrayobject.h"
- CMake链接库在Docker映像中失败
- 使用cmake链接错误
- 如何使用CMake链接顶点?
- 无法在VS2017上将libclang与cmake链接
- 将枚举与 CMake 链接的正确方法是什么?
- 如何使用 cmake 链接库
- 将boost_numpy3与 CMAKE 链接
- CMake 链接 2 个具有相对路径的库
- Ogre 3D共享库与CMAKE链接时,在Linux上执行二进制时找不到
- 在 Android Studio 中使用 NDK、Gradle 和 CMake 链接外部库
- cmake链接错误2
- 无法通过 CMake 链接 Boost 1.63.0
- Android Native:CMake 链接错误:未定义对 GL 函数的引用 - 即使包含并链接了 EGL 和 GLESv3