当前位置: 技术问答>linux和unix
求助,关于编译时的库链接问题
来源: 互联网 发布时间:2016-07-08
本文导语: 这是Qt creator编译时的错误: mainwindow.o: In function `MainWindow::openFile()': /home/Evix/workspace/QT/MyPDF/mainwindow.cpp:61: undefined reference to `Poppler::Document::numPages() const' mainwindow.o: In function `MainWindow::nextPage()': /home/Evix/workspace/...
这是Qt creator编译时的错误:
mainwindow.o: In function `MainWindow::openFile()':
/home/Evix/workspace/QT/MyPDF/mainwindow.cpp:61: undefined reference to `Poppler::Document::numPages() const'
mainwindow.o: In function `MainWindow::nextPage()':
/home/Evix/workspace/QT/MyPDF/mainwindow.cpp:79: undefined reference to `Poppler::Document::numPages() const'
/home/Evix/workspace/QT/MyPDF/mainwindow.cpp:80: undefined reference to `Poppler::Document::numPages() const'
/usr/bin/ld: Dwarf Error: Offset (82136) greater than or equal to .debug_str size (18758).
pdf.o: In function `~PDF':
/home/Evix/workspace/QT/MyPDF/pdf.cpp:16: undefined reference to `Poppler::Document::~Document()'
/home/Evix/workspace/QT/MyPDF/pdf.cpp:16: undefined reference to `Poppler::Document::~Document()'
/home/Evix/workspace/QT/MyPDF/pdf.cpp:16: undefined reference to `Poppler::Document::~Document()'
pdf.o: In function `PDF::showPage(int)':
/home/Evix/workspace/QT/MyPDF/pdf.cpp:42: undefined reference to `Poppler::Document::page(int) const'
/home/Evix/workspace/QT/MyPDF/pdf.cpp:42: undefined reference to `Poppler::Page::renderToImage(double, double, int, int, int, int, Poppler::Page::Rotation) const'
pdf.o: In function `PDF::setDocument(QString const&)':
/home/Evix/workspace/QT/MyPDF/pdf.cpp:50: undefined reference to `Poppler::Document::load(QString const&, QByteArray const&, QByteArray const&)'
/home/Evix/workspace/QT/MyPDF/pdf.cpp:53: undefined reference to `Poppler::Document::~Document()'
/home/Evix/workspace/QT/MyPDF/pdf.cpp:54: undefined reference to `Poppler::Document::setRenderHint(Poppler::Document::RenderHint, bool)'
/home/Evix/workspace/QT/MyPDF/pdf.cpp:55: undefined reference to `Poppler::Document::setRenderHint(Poppler::Document::RenderHint, bool)'
collect2: ld 返回 1
make: *** [MyPDF] 错误 1
Exited with code 2.
Error while building project MyPDF
When executing build step 'Make'
我的操作系统是fedora11 用qt开发一个pdf阅读器,用的是poppler库,poppler安装成功,#include包含的.h文件路径没错。/usr/lib有libpoppler.so.4.0.0的动态链接文件,我在/lib和/usr/lib中都创建了libpoppler.so的符号链接指向libpoppler.so.4.0.0。请问大家这怎么解决?
mainwindow.o: In function `MainWindow::openFile()':
/home/Evix/workspace/QT/MyPDF/mainwindow.cpp:61: undefined reference to `Poppler::Document::numPages() const'
mainwindow.o: In function `MainWindow::nextPage()':
/home/Evix/workspace/QT/MyPDF/mainwindow.cpp:79: undefined reference to `Poppler::Document::numPages() const'
/home/Evix/workspace/QT/MyPDF/mainwindow.cpp:80: undefined reference to `Poppler::Document::numPages() const'
/usr/bin/ld: Dwarf Error: Offset (82136) greater than or equal to .debug_str size (18758).
pdf.o: In function `~PDF':
/home/Evix/workspace/QT/MyPDF/pdf.cpp:16: undefined reference to `Poppler::Document::~Document()'
/home/Evix/workspace/QT/MyPDF/pdf.cpp:16: undefined reference to `Poppler::Document::~Document()'
/home/Evix/workspace/QT/MyPDF/pdf.cpp:16: undefined reference to `Poppler::Document::~Document()'
pdf.o: In function `PDF::showPage(int)':
/home/Evix/workspace/QT/MyPDF/pdf.cpp:42: undefined reference to `Poppler::Document::page(int) const'
/home/Evix/workspace/QT/MyPDF/pdf.cpp:42: undefined reference to `Poppler::Page::renderToImage(double, double, int, int, int, int, Poppler::Page::Rotation) const'
pdf.o: In function `PDF::setDocument(QString const&)':
/home/Evix/workspace/QT/MyPDF/pdf.cpp:50: undefined reference to `Poppler::Document::load(QString const&, QByteArray const&, QByteArray const&)'
/home/Evix/workspace/QT/MyPDF/pdf.cpp:53: undefined reference to `Poppler::Document::~Document()'
/home/Evix/workspace/QT/MyPDF/pdf.cpp:54: undefined reference to `Poppler::Document::setRenderHint(Poppler::Document::RenderHint, bool)'
/home/Evix/workspace/QT/MyPDF/pdf.cpp:55: undefined reference to `Poppler::Document::setRenderHint(Poppler::Document::RenderHint, bool)'
collect2: ld 返回 1
make: *** [MyPDF] 错误 1
Exited with code 2.
Error while building project MyPDF
When executing build step 'Make'
我的操作系统是fedora11 用qt开发一个pdf阅读器,用的是poppler库,poppler安装成功,#include包含的.h文件路径没错。/usr/lib有libpoppler.so.4.0.0的动态链接文件,我在/lib和/usr/lib中都创建了libpoppler.so的符号链接指向libpoppler.so.4.0.0。请问大家这怎么解决?
|
发个makefile吧..找不到库
添加 -lpoppler了吗??
LD_LIB_PATH 添加库所在的路径
添加 -lpoppler了吗??
LD_LIB_PATH 添加库所在的路径
|
楼上的,他这个是动态链接库
不能用-lpoppler这么调用吧,这是静态的方法
不能用-lpoppler这么调用吧,这是静态的方法
|
贴一下你的编译命令行。
-lpoppler是动态链接。添加-L/usr/lib -lpoppler.
-lpoppler是动态链接。添加-L/usr/lib -lpoppler.
|
纯友情UP 希望楼主早日解决问题