/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 to
lzma_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 to
lzma_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/