在Qt Creator中利用poppler-帮助 [英] exploiting poppler in Qt creator - help

查看:356
本文介绍了在Qt Creator中利用poppler-帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编译一个将poppler库用于pdf(linux)的Qt项目.

I am trying to compile a Qt project that uses poppler library for pdf (linux).

我将#include放在mainwindow.cpp中 我将poppler文件夹放在除mainwindow.cpp之外的项目文件夹中 poppler-qt4.h位于poppler-0.16.7/qt4/src

I put #include in the mainwindow.cpp I put poppler folder in my project folder besides mainwindow.cpp poppler-qt4.h is in poppler-0.16.7/qt4/src

我不需要重新编译poppler,我只需要通过其标头链接库,但我不知道该怎么做.如果需要编译,我可以做,但是我尝试了./configure并说"./configure not found". 我搜索了其他类似的线程,但是它们对我来说不够有用. 我知道LIBS参与其中,但是makefile被Qt-creator覆盖了吗? 我更喜欢学习如何正式"通知Qt-creator我要添加库. 请帮忙吗?

I do not need to recompile poppler, I just need to link the library through its headers but I do not know how to do. If compilation is necessary I can do it, but I tried ./configure and it said "./configure not found". I searched for other similar threads but they were not enough useful to me. I know LIBS is involved but makefile is overwritten by Qt-creator? I'd prefer to learn how to "officially" inform Qt-creator that I want to add the library. Please can help?

推荐答案

您有一个很好的示例,其中包含源代码,位于:

You have a good example, completed with source code, here: Poppler: Displaying PDF files with Qt

除了在适当的位置包含头文件之外,您还需要链接到poppler库.

Along with including the header files where apropriate, you need to link to the poppler library.

为此,您需要编辑.pro文件,并添加以下内容:

To do so, you need to edit your .pro file and include something like:

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

这些是默认"路径,您可能需要根据自己的特定安装位置进行相应的更改.

These are the "default" paths, you may need to change them accordingly to your particular install location.

从您的评论看来,您似乎正在尝试从源代码构建poppler lib.问题是您在错误的目录中执行./configure(make和make install).您需要"将自己置于文件 configure 所在的目录(*)中.然后执行传统命令:

From your comments you seem to be trying to build poppler lib from source. The problem is that you're executing ./configure ( make and make install ) in the wrong directory. You "need" to position yourself in the directory where the file configure is located(*). Then execute the traditional commands:

./configure
make 
make install

  1. 您运行configure(通常必须最多输入./configure. 人们的搜索路径中没有当前目录).这 构建一个新的Makefile.
  2. 键入make这将生成程序.也就是说,make将会是 执行后,它将在Makefile中寻找第一个目标并执行以下操作 指示说.预期的最终结果将是建立一个 可执行程序.
  3. 现在,以root身份输入make install.这再次调用make,make 在Makefile中找到目标安装并将其说明归档到 安装程序.
  1. You run configure (you usually have to type ./configure as most people don't have the current directory in their search path). This builds a new Makefile.
  2. Type make This builds the program. That is, make would be executed, it would look for the first target in Makefile and do what the instructions said. The expected end result would be to build an executable program.
  3. Now, as root, type make install. This again invokes make, make finds the target install in Makefile and files the directions to install the program.

我从 http://tldp.org/LDP/LG/current中提取了此报价/smith.html .但是,在很多地方都可以找到有关这些命令的更多信息.只是谷歌! :D

I extracted this quote from http://tldp.org/LDP/LG/current/smith.html. But there are lots of places where you can find more information about these commands. Just google it! :D

(*)您实际上并不需要与 configure 文件位于同一目录中.但这比编写完整路径容易.

(*) You don't really need to be in the same directory as the configure file. But it's easier than writing the full path.

这篇关于在Qt Creator中利用poppler-帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆