1
votes

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

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

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?

1

1 Answers

3
votes

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

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

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.

EDIT:

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. 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.

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

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