glui /usr/bin/ld: 找不到 -lXmu
我已经下载了最新的 GLUI 源代码,现在我正在尝试编译它。当我这样做时,我收到以下错误:
g++ -O0 -Wall -pedantic -I./ -I./include -I/usr/X11R6/include -o bin/example1 example/example1.cpp -L./lib -lglui -L/usr/X11R6/lib/libXdmcp.a -lglut -lGLU -lGL -lXmu -lXext -lX11 -lXi -lm
/usr/bin/ld: cannot find -lXmu
collect2: ld returned 1 exit status
当我执行locate libXmu
时,我收到以下输出:
> %:~/src/GLUI/src$ locate libXmu
> /usr/lib/libXmu.so.6
> /usr/lib/libXmu.so.6.2.0
> /usr/lib/libXmuu.so.1
> /usr/lib/libXmuu.so.1.0.0
我收到错误是因为我没有 /usr/lib/libXmu.lib 吗?所以?如果是这种情况,我该如何制作呢? (我根本没有链接经验)。
谢谢!
I have downloaded the latest GLUI source code and now I am trying to compile it. When I do so, I get the following error:
g++ -O0 -Wall -pedantic -I./ -I./include -I/usr/X11R6/include -o bin/example1 example/example1.cpp -L./lib -lglui -L/usr/X11R6/lib/libXdmcp.a -lglut -lGLU -lGL -lXmu -lXext -lX11 -lXi -lm
/usr/bin/ld: cannot find -lXmu
collect2: ld returned 1 exit status
When I did a locate libXmu
, I get the following output:
> %:~/src/GLUI/src$ locate libXmu
> /usr/lib/libXmu.so.6
> /usr/lib/libXmu.so.6.2.0
> /usr/lib/libXmuu.so.1
> /usr/lib/libXmuu.so.1.0.0
Do I get the error because I don't have a /usr/lib/libXmu.so? If this is the case, how can I make one? (I am not experienced with linking at all).
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Linux 发行版通常将运行程序所需的库与构建程序所需的文件分开打包。
查找名为 *-devel 或 *-dev 的包。
我不知道您特别需要哪一个,但您可以使用 apt-cache search 来查找它。
Linux distributions usually package the libraries needed for running programs separately from the files needed to build programs.
Look for packages named *-devel or *-dev.
I don't know which one you need in particular for this, but you can use apt-cache search to look for it.
答案实际上是最初的答案之一,但似乎被所有者删除了。我能够通过创建到最新版本的库的符号链接(即
/usr/lib/libXmu.so.6
)并成功编译代码来解决该问题。The answer was actually one of the first ones here originally but the owner deleted it, it seems. I was able to solve the problem by creating a symbolic link to the latest version of the library (i.e.
/usr/lib/libXmu.so.6
) and compile the code successfully.我遇到了同样的问题,如果创建符号链接没有帮助,
尝试以下操作:
并检查您需要的库文件是否位于这些目录之一中。
使用“export PATH=/newly/added/path:$PATH”添加新目录进行检查。
继续努力吧。
I had the same problem, if creating a symbolic link doesnt help,
try the following:
and check if the library file you need is in one of those directories.
Use "export PATH=/newly/added/path:$PATH" to add new directory to check.
Keep it up.
从 Ubuntu 22.04 开始(也可能在早期版本中),包
libxmu6
提供以下文件(其中一个是符号链接):而包
libxmu-dev
提供以下文件(实际上是一个符号链接):libXmu.so
符号链接是链接器将找到的内容(如果存在)。因此,要通过 apt 安装 libXmu.so 符号链接,请运行以下命令(如@Salami 上面所述):
As of Ubuntu 22.04 (and probably also in earlier versions), the package
libxmu6
provides the following files (one of which is a symlink):Whereas the package
libxmu-dev
provides the following file (which is actually a symlink):The
libXmu.so
symlink is what the linker will find, if it exists.So to install the
libXmu.so
symlink viaapt
, run the below command (as mentioned by above by @Salami):