gpt4 book ai didi

c++ - Qt5 : Poppler weird linker error

转载 作者:太空宇宙 更新时间:2023-11-04 13:53:37 30 4
gpt4 key购买 nike

我从 this page 下载了预构建的 win32 poppler 二进制文件.在.pro文件中添加了include文件夹和lib文件夹的路径:

INCLUDEPATH += "C:\\test_folder\\poppler-0.24.5-win32\\include\\poppler-qt5"
LIBS += -L/"C:\\test_folder\\poppler-0.24.5-win32\\lib"

在 main.cpp 中我包含了“poppler-qt5.h”没有错误,所以我认为 poppler 被正确添加了。但是,当通过打开 pdf 文件对其进行测试时,as described here ,

QString path = "C:\\Windows\\System32\\spool\\PRINTERS\\test_file.pdf";
Poppler::Document *doc = Poppler::Document::load(path);

我收到链接器错误:

Error message

有人可以帮我吗?

最佳答案

我在你的 LIBS 行中缺少 -l

LIBS += -L/"C:\\test_folder\\poppler-0.24.5-win32\\lib" -lpoppler-qt5

最终重命名库,因为 .dll.a 不是 Windows 中的标准扩展名。

编辑:无需重命名库即可工作:

.pro 文件:

INCLUDEPATH += $$quote(D:\Users\username\Downloads\poppler-0.24.5-win32\poppler-0.24.5-win32\include\poppler-qt5)
LIBS += -L$$quote(D:\Users\username\Downloads\poppler-0.24.5-win32\poppler-0.24.5-win32\lib) -lpoppler-qt5

.cpp 文件:

#include <QApplication>
#include <mycpp.h>

#include <poppler-qt5.h>

/* Some Code here */
QString path = "D:\\SomePDF.pdf";
Poppler::Document *doc = Poppler::Document::load(path);
/* More Code here */

关于c++ - Qt5 : Poppler weird linker error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22536032/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com