c++ - ld路径更新用于编译

标签 c++ linux path compilation

我刚刚手动安装了aprapr_util,这样我就可以安装activemq c++库。

当我尝试制作 cpp 库时,出现以下错误:

**

libtool:链接:g++ -ansi -pedantic -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -I/usr/local/apr/include/apr-1 -I/usr/local/apr/include/apr-1 -I/usr/kerberos/include -W -Wall -Wextra -Wconversion -fPIC -fstrict-aliasing -Wstrict-aliasing=2 -Wno-long-long -D LINUX=2 -D_REENTRANT -D_GNU_SOURCE -I/usr/local/apr/include/apr-1 -I/usr/local/apr/include/apr-1 -I/usr/kerberos/include -Wno-非虚拟-dtor -Wno-unused-parameter -Wno-uninitialized -I./../main -g -O2 -pthread -o .libs/example example-main.o ../main/.libs/libactivemq-cpp.so -lexpat -L/usr/kerberos/lib64/usr/local/apr/lib/libaprutil-1.so/usr/local/apr/lib/libapr-1.so -luuid -lrt -lcrypt/usr/local/apr/lib/libexpat.so -lssl -lcrypto -ldl -lz -lpthread -pthread -Wl,-rpath -Wl,/usr/local/lib -Wl,-rpath -Wl,/usr/local/apr/lib /usr/bin/ld: 找不到 -lexpat collect2:ld返回1退出状态

**

expat位于apr-util内并且未链接。我如何更新 ld 路径以便 make 或环境能够找到它?

或者简而言之:我该如何解决这个问题?

最佳答案

通常您需要使用 -L 选项手动指定库路径。

它看起来像单个ld操作中的ld filename -Lpath -llibname。或者在这种情况下,您可能需要将库的路径(此处为 apr-util)添加到 Makefile 中的库路径常量。

关于c++ - ld路径更新用于编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7898552/

相关文章:

c# - Visual Studio 2010 项目到 Visual Studio 2012

linux - 如何在 PAM 之后而不是在重新映射用户之前告诉 SSH 到 setuid

delphi - 有没有人写过一些 delphi 代码来实现 REGJUMP 的功能?

python - __file__ 和 os.path 模块运行不正常?

c++ - 遍历 std :list<wstring>

c++ - 模板模板部分特化仅适用于 -std=c++1z 和 g++

c++ - unsigned long long 的问题

linux - 手册页中的省略号 (...) 是什么意思

python - 我可以将 libVLC 的 Python 绑定(bind)与 Python 3.x 一起使用吗?

c# - C# 中的相对路径