c++ - 使用 poppler 在 Qt5 中链接时出错

标签 c++ linux qt5 poppler

/usr/lib/libpoppler.so.50: undefined reference to std::__throw_out_of_range_fmt(char const*, ...)@GLIBCXX_3.4.20' Makefile:156: recipe for target 'DocViewer' failed /usr/lib/libsystemd.so.0: undefined reference tolzma_stream_decoder@XZ_5.0' /usr/lib/libQt5Core.so: undefined reference to __cxa_throw_bad_array_new_length@CXXABI_1.3.8' /usr/lib/libsystemd.so.0: undefined reference tolzma_end@XZ_5.0' /usr/lib/libsystemd.so.0: undefined reference to `lzma_code@XZ_5.0' collect2: error: ld returned 1 exit status make: *** [DocViewer] Error 1 20:53:35: The process "/usr/bin/make" exited with code 2.

Qt5 中使用 poppler 编译程序时出现上述错误。

下面是我的项目文件,需要修改什么吗?

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = DocViewer
TEMPLATE = app

INCLUDEPATH  += /usr/include/poppler/qt5
LIBS         += -L/usr/lib -lpoppler-qt5

SOURCES += main.cpp\
        mainwindow.cpp

HEADERS  += mainwindow.h

FORMS    += mainwindow.ui

最佳答案

对于 libicu 中的“__cxa_throw_bad_array_new_length@CXXABI_1.3.8”错误,看起来问题是不兼容的 icu 构建(softfp vs hardfp)。

我有同样的错误,我通过下载重建的 ICU 解决了这个问题(以避免自己重建它)。

  • 从以下位置下载“POT”二进制文件 http://thebugfreeblog.blogspot.fr/2016/12/binaries-for-pot-550-beta1-on-qt-580.html .
  • lrzuntar 文件
  • tar xf qtdeps.tar
  • 在设备上,移走 libicu*(在我使用 raspbian 的情况下,它在 usr/lib/arm-linux-gnueabihf 中),然后从那边的 qtdeps 传输 libicu*
  • 在设备上,移走“unicode”包含目录(对于 raspbian,它位于/usr/include/arm-linux-gnueabihf/unicode),然后从那边的 qtdeps 复制 unicode 包含目录。
  • 使用 rsync 从设备重新同步到您的 sysroot
  • 重新配置并重建 qtbase(在删除 qtbase/src/corelib 下名称中包含“icu”的 .o 文件后 - 或者从头开始重建 Qt)

关于c++ - 使用 poppler 在 Qt5 中链接时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29318945/

相关文章:

c++ - Visual Studio 的对象文件

linux - 如何在 C 代码中从其中一个进程触发时重新启动一组进程

c - 如何从 C 程序为接口(interface)设置 ipv6 地址

c++ - 如何轮询一个字节最多 1ms?

c++ - 在 QTabWidget 中动态设置单个选项卡的样式

qt - 关闭 Qt creator 5 : "Unexpected CDB error" 后的错误消息

c++ - 在 C++ 中跨程序共享指针

c++ - 推导可变参数模板连接

c++ - 迭代器 for 循环不会确认循环完成条件

c++ - 带箭头的 Qt 工具提示