【问题标题】:ld: library not found for -lX11ld: 找不到 -lX11 的库
【发布时间】:2017-03-06 19:09:59
【问题描述】:
  1 CC = g++
  2 FLAGS = -g -DGL_GLEXT_PROTOTYPES -I./glm -Wall
  3 LDFLAGS = -lX11 -lpthread

所以我的 Makefile 中有这些 但我得到了错误

ld: library not found for -lX11

clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [compile-debug] Error 1

不知道应该怎么解决

【问题讨论】:

  • 你的控制台中locate libX11的输出是什么?
  • 为 Ubuntu 安装 libx11-dev,或为 Fedora/Red Hat 安装 libX11-devel。或者告诉我们您在哪个平台上。
  • 在 macOS Sierra 上
  • locate libX11 /opt/X11/lib/libX11-xcb.1.dylib /opt/X11/lib/libX11-xcb.dylib /opt/X11/lib/libX11.6.dylib /opt/X11/lib/libX11.dylib

标签: c++ makefile linker x11 compiler-flags


【解决方案1】:

您需要在 makefile 中更改这一行,因为 libX11 位于自定义目录中:

LDFLAGS = -L/opt/X11/lib -lX11 -lpthread

【讨论】:

    猜你喜欢
    • 2012-12-08
    • 1970-01-01
    • 2014-12-13
    • 2021-10-24
    • 2017-03-31
    • 1970-01-01
    • 2011-09-26
    • 2018-03-10
    • 2017-08-08
    相关资源
    最近更新 更多