Hi everyone.
I have been trying from a few days ago to generate a static version of the poppler library, specifically of the qt version (poppler-qt4), for using in Windows. I was searching on the Internet, I found KDE Windows Initiative, where I could download the binaries and source codes from poppler and most of its dependencies, but cairo. The problem was that this binaries files were dynamic and, from the files with .lib extension (poppler.lib, poppler-cpp.lib, poppler-qt4.lib), only poppler.lib was a static library. Due to this, and using the cMake files content in the download of the source code of poppler I tried to generate static versions from all the dependencies of poppler, which was an easy thing to do except with cairo, that was a little big harder to do using the msvc2008 compiler. When I had the static version I tried to generate a basic application made in qt4, which has the poppler-qt4.lib library.
The mencionated application is the following:

#include "mainwindow.h"
#include "ui_mainwindow.h"

#include <poppler/qt4/poppler-qt4.h>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    QString filename = "C:\\file.pdf";
    ui->setupUi(this);
    Poppler::Document *doc = Poppler::Document::load(filename);
}

MainWindow::~MainWindow()
{
    delete ui;
}

The file with extension .pro is the following:

QT       += core gui
TARGET = poppler-static
TEMPLATE = app
SOURCES += main.cpp\
        mainwindow.cpp
HEADERS  += mainwindow.h
FORMS    += mainwindow.ui

and the error message I got with the link, is the following:
error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class Poppler::Document * __cdecl Poppler::Document::load(class QString const &,class QByteArray const &,class QByteArray const &)" (__imp_?load@Document@Poppler@@SAPAV12@ABVQString@@ABVQByteArray@@1@Z) referenced in function "public: __thiscall MainWindow::MainWindow(class QWidget *)" (??0MainWindow@@QAE@PAVQWidget@@@Z)

The funny thing is that using the dumpbin tool from Visual Studio, when I execute the command: "dumpbin /headers poppler-qt4.lib", all the functions that the library contains appear and in the output generated I found this:

SECTION HEADER #25E
   .text name
       0 physical address
       0 virtual address
     155 size of raw data
    FA88 file pointer to raw data (0000FA88 to 0000FBDC)
    FBDD file pointer to relocation table
       0 file pointer to line numbers
       D number of relocations
       0 number of line numbers
60501020 flags
         Code
COMDAT; sym= "public: static class Poppler::Document * __cdecl Poppler::Document::load(class QString const &,class QByteArray const &,class QByteArray const &)" (?load@Document@Poppler@@SAPAV12@ABVQString@@ABVQByteArray@@1@Z)
         16 byte align
         Execute Read

This makes a direct reference to the method that is called in the previous code shown. Another important detail is that when I eliminate the inclusion of poppler-qt4.lib in the proyect's properties, I'm getting the same error, as if it's not being used and if I use the dynamic version the program gets compiled without any problem but the resultant executable asks for the respecive dll (logically).

I don't know if this is due to poppler more than to qt, but I'm going to post it in both to see if somebody can help me with this error, because I just can't understand the reason why the link fails if the library contains the right solicited function.

As an additional information, my operative system is Windows 7 64-bits and I'm using Visual Studio 2008. The application is compiled in release for 32 bits using the static build of qt 4.7.1 built with the msvc2008.

Thank you very much in advance to everybody who analize this.
Regards.

_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to