在Qt4项目中引用mupdf
我在 /usr/local/lib (之前编译过)中有 libfitz.a 和 libmupdf.a 。 然后我包含了标题:
#include <fitz.h>
#include <mupdf.h>
然后我将:放入
INCLUDEPATH +=/home/pc/sviluppo/mupdf-0.9
INCLUDEPATH +=/home/pc/sviluppo/mupdf-0.9/fitz
INCLUDEPATH +=/home/pc/sviluppo/mupdf-0.9/pdf
LIBS += -L/usr/local/lib -lfitz
LIBS += -L/usr/local/lib -lmupdf
.pro 文件中,但我的程序仅到达标题中的类型,而不是库中的类型。错误是
/.../mainwindow.cpp:-1: error: undefined reference to `pdf_open_xref(pdf_xref_s**, char const*, char*)'
怎么了?
I have libfitz.a and libmupdf.a in /usr/local/lib (previously compiled).
then I included the headers:
#include <fitz.h>
#include <mupdf.h>
then I put:
INCLUDEPATH +=/home/pc/sviluppo/mupdf-0.9
INCLUDEPATH +=/home/pc/sviluppo/mupdf-0.9/fitz
INCLUDEPATH +=/home/pc/sviluppo/mupdf-0.9/pdf
LIBS += -L/usr/local/lib -lfitz
LIBS += -L/usr/local/lib -lmupdf
in .pro file, but my program just reaches to types in the headers, not the library. The error is
/.../mainwindow.cpp:-1: error: undefined reference to `pdf_open_xref(pdf_xref_s**, char const*, char*)'
What's wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个 C 库,他们没有使用
extern "C"
来允许头文件轻松包含在 C++ 中。所以你必须自己做:
根据mupdf MakeFile,你应该将库按顺序放入你的.pro中(更依赖的静态库应该放在它的依赖项之前):
This is a C library, and they didn't use
extern "C"
to allow the headers to be included easily in C++.So you have to do it yourself:
According to mupdf MakeFile, you should put the libraries in that order in your .pro (the more dependent static library should be placed before its dependencies):