如何消除这个链接错误
how to get rid of this linking error?
我正在尝试编译一些文件,这很好,但当我尝试按以下方式链接它们时,我收到了一个错误:
Building target: EoCu
Invoking: GCC C++ Linker
g++ -L"/home/workspace/production-Alginterface/Shared/libs" -m32 -g -rdynamic -Wl,-rpath-link=../../production-Alginterface/Shared/libs -g -rdynamic -o "EoCu" ./simpleini/ConvertUTF.o ./simpleini/snippets.o ./Tinyxpath/action_store.o ./Tinyxpath/htmlutil.o ./Tinyxpath/lex_util.o ./Tinyxpath/node_set.o ./Tinyxpath/tinystr.o ./Tinyxpath/tinyxml.o ./Tinyxpath/tinyxmlerror.o ./Tinyxpath/tinyxmlparser.o ./Tinyxpath/tokenlist.o ./Tinyxpath/xml_util.o ./Tinyxpath/xpath_expression.o ./Tinyxpath/xpath_processor.o ./Tinyxpath/xpath_stack.o ./Tinyxpath/xpath_static.o ./Tinyxpath/xpath_stream.o ./Tinyxpath/xpath_syntax.o ./AlarmsMsg.o ./AppWatchDog.o ./BaseIteration.o ./CommunicationManager.o ./ConfigValidator.o ./FilesMng.o ./GuiInputHandler.o ./GuiManager.o ./IniReader.o ./IniWriter.o ./MessageBuilder.o ./MngFile.o ./MsgBroker.o ./NetworkDisconnectTimerCallable.o ./ShareDialog.o ./SpoIteration.o ./TCPServer.o ./Timer.o ./TimerCallable.o ./TrendsRecorder.o ./TrendsUtlFunc.o ./XMLBuilder.o ./XMLParser.o ./actmgr.o ./cdlCom.o ./entry.o ./ioctrl.o ./iteration.o ./msgqueue.o ./prmdb.o ./qthread.o ./usbDrive.o -lrt -llog4cxx -lapr-1 -laprutil-1 -lexpat -lpthread
当我通过eclipse编译和运行时,我已经输入了正确的库,它运行得很好,但当我通过make文件这样做时,我会收到这个错误,尽管它是相同的make文件!,有人能帮我吗?
/usr/bin/ld: warning: libexpat.so.0, needed by /home/workspace/production-Alginterface/Shared/libs/libaprutil-1.so, not found (try using -rpath or -rpath-link)
提前谢谢。
eclipse很可能使用了不同的工作目录,因此rpath-link
有不同的含义:
-Wl,-rpath-link=../../production-Alginterface/Shared/libs
^^^^^^
请尝试使用绝对路径。
如果您已经在gcc的命令行中指定了-L
,为什么需要这样做?在ld(1)
中,我猜会为您的其他共享库所需的共享库搜索一条单独的路径。
在这种情况下,您需要libaprutil-1.so
,因为您与-laprutil-1
链接。是libaprutil想要libexpat.so.0
,而rpath-link
是ld
搜索到的路径。
相关文章:
- 静态数据成员的问题-修复链接错误会导致编译器错误
- Visual Studio mkl_link_tool.exe链接错误
- C++ 实现模板单例类时出现链接错误
- 使用类模板的方法链接错误
- MySQL C++连接器链接错误
- VS 2015 链接错误 无法构建依赖于 libcurl 的项目
- 运行 C++ 单元测试时LNK2005链接错误
- 对 CMake 中'cudaRegisterLinkedBinary'链接错误的未定义引用?
- 链接错误,包括我创建的相同头文件 - C++
- 在Embarcadero C++ Builder中生成的DLL未解决的外部链接错误
- 使用标头保护的多个定义链接错误
- 链接错误:未定义对 stdscr 和 wgetch 的引用
- 使用 Vivek 的 Vcam / 捕获源过滤器构建/链接错误
- 升压program_options中的链接错误
- 使用 g++ 预处理器进行替换会导致链接错误
- 在调试配置中编译工作正常,但发布会给出链接错误
- 相邻矩阵设置链接错误
- 包含常量变量并包含在多个文件中的标头的链接错误
- C++链接错误,我理解但无法解决
- 是什么导致macOS Mojave上的GoogleTest链接错误