Undefined reference to PoDoFo::...

I'm trying to do a program that will read a pdf we get from work with our schedule, and give a file in the icalendar or csv format (or some other format if my friends asks for it) so we can sync it with our calendars (eg google calendar). I've looked for libraries that parse pdf's and the best one so far seems to be PoDoFo (http://podofo.sourceforge.net/index.html). So since I'm on Ubuntu I installed the libpodofo-dev package from the default repositories.

I have podofo/base/PdfParser.h and podofo/base/PdfVecObjects.h included, but it seems like my compiler can't find it. I get these error messages:
main.cpp:(.text+0xaf): undefined reference to `PoDoFo::PdfVecObjects::PdfVecObjects()'
main.cpp:(.text+0xc7): undefined reference to `PoDoFo::PdfParser::PdfParser(PoDoFo::PdfVecObjects*)'
collect2: ld returned 1 exit status

Here's (parts of) my code:
#include <QFileDialog>
#include <podofo/base/PdfParser.h>
#include <podofo/base/PdfVecObjects.h>


void readPDF(QFile file)
    PoDoFo::PdfVecObjects *pdfVecObject = new typename PoDoFo::PdfVecObjects::PdfVecObjects;
    PoDoFo::PdfParser *parser = new typename PoDoFo::PdfParser::PdfParser(pdfVecObject);

I'm pretty sure the rest of the code has nothing to do with it.

So.. How am I reffering to the PoDoFo classes wrong?
Also, I'm using the IDE "Qt Creator" and I haven't modified the compiler flags.
You are missing some library file probably. Are you sure you are linking to the PoDoFo library correctly?
I'm not totally sure, but I think so. If I write something else (like "/podofo/base/foo.h") I get another error message:
../schema/main.cpp:6:34: fatal error: podofo/base/foo.h: No such file or directory

And both header files exist under /usr/include/podofo/base/.
Last edited on
I think it finds the header but not the object file which it's supposed to link. I have no idea where the object files for podofo are.
It's not "WHERE". It's "WHICH". You need to know their name. Then linking them is quite easy, you just have to find a Linking List in your IDE.
Well isn't the name the same as the header name? Where can I find a "Linking list" in Qt Creator?
$ g++ main.o -lpodofo -o program.bin
You may need to specify the library path with -L
That worked! Thank you guys!

Since I use qt creator which uses qmake, and not g++, I found out I needed to add "LIBS += -L/path/to/sfml -lsfmlsystem -lsfmlwindow" in myproject.pro
Topic archived. No new replies allowed.