[poppler] Linking Poppler to Code::Blocks

Christopher Icely christophericely at gmail.com
Sat Apr 20 11:20:42 PDT 2013

Good Day All,

Firstly, I do apologize if this is the incorrect forum in which to ask my
questions however, I'm really at my wit's end with this problem and I was
hoping one of you could perhaps help me.

Basically I wish to write code that will allow me to extract annotations
from PDFs. However, I'm yet to write any code as I've spent an inordinate
amount of time in just getting Poppler built. These are the steps I've
followed so far:

{System specs: Windows 7, MinGW, CodeBlocks}

1) I have a folder structure like so:

The file "poppler-0.22.2" is the unzipped source files while the
"poppler-0.22.2_Build" file was made by the Cmake GUI with Cairo, JPEG, QT4
and TIFF included. Furthermore, Cmake was instructed to generate a
"CodeBlocks - MinGW Makefiles".

2) After the CodeBlocks project was generated by Cmake, the project was
built in CodeBlocks and I was left with the following:


3) Now i need to link the poppler library to my project. Therefore in
CodeBlocks I did the following:

a)Settings->Compiler->Linker settings: Link libraries
    and I set the path to:

b)Then in  Settings->Compiler->Search directories->Linker
    I set the path to:

c)Then I set up the linking for my project:
    Project->Build Options->Linker settings
    and set the path to

d)And finally:
    Project->Build Options->Search directories->Linker
    and add the path:

4) I have now written the following code in my main.cpp just to see if
everything works:

1 : #include <iostream>
2 : #include
3 : #include
4 :
5 : using namespace std;
6 :
7 : int main()
8 : {
9 :
11:   const string dir =
"C:\\Users\\Chris\\Documents\\WorkForDad\\2013\\Pdf Automation\\Anotation
Extraction\\Remuneration Report.pdf";
13:    poppler::document *doc = poppler::document::load_from_file(dir);
15:    return 0;
16: }

However, I get the following error in my"Build messages" when I build the

Automation\Test\Clean\main.cpp||In function 'int main()':|
Automation\Test\Clean\main.cpp|13|warning: unused variable 'doc'
obj\Debug\main.o||In function `main':|
Automation\Test\Clean\main.cpp|13|undefined reference to
||=== Build finished: 1 errors, 1 warnings (0 minutes, 1 seconds) ===|


And in the "Build log" I get the following:

-------------- Clean: Debug in Clean (compiler: GNU GCC

Cleaned "Clean - Debug"

-------------- Build: Debug in Clean (compiler: GNU GCC

mingw32-g++.exe -Wall -fexceptions  -g  -g    -c
Automation\Test\Clean\main.cpp" -o obj\Debug\main.o
Automation\Test\Clean\main.cpp: In function 'int main()':
Automation\Test\Clean\main.cpp:13:24: warning: unused variable 'doc'
mingw32-g++.exe -L..\..\..\..\..\Poppler\build\poppler-0.22.2_Build
-LC:\Users\Chris\Documents\Poppler\build\poppler-0.22.2_Build  -o
bin\Debug\Clean.exe obj\Debug\main.o

obj\Debug\main.o: In function `main':
Automation/Test/Clean/main.cpp:13: *undefined reference to
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 1 seconds)
1 errors, 1 warnings (0 minutes, 1 seconds)


So as you can see, the problem would seem to be a linking error of some
sort due to the presence of : "undefined reference to

Also, I have no idea what the "_imp__" + (random characters) means. From
some research I've discovered that this "_imp__" problem has something to
do with C to C++ code conversion however I have no idea if this is the case
now or how I would go out about fixing this problem.

So there it all is, I hope someone can help me and I really appreciate all
of you who took the time to read the above and for any assistance you can
provide me.

Kind Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20130420/5c974383/attachment.html>

More information about the poppler mailing list