<div dir="ltr"><div><div><div><div><div>Good Day All,<br><br></div>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.<br>
<br></div>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:<br>
<br></div><div>{System specs: Windows 7, MinGW, CodeBlocks}<br></div><div><br></div>1) I have a folder structure like so: <br> C:\Users\Chris\Documents\Poppler\build\<br></div> ------------------------->poppler-0.22.2<br>
<div> ------------------------->poppler-0.22.2_Build<br><br></div><div>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".<br>
</div><div><br></div><div>2) After the CodeBlocks project was generated by Cmake, the project was built in CodeBlocks and I was left with the following:<br><br> C:\Users\Chris\Documents\Poppler\build\poppler-0.22.2_Build\<br>
</div><div> -------------------------->CMakeFiles<br></div><div> -------------------------->cpp<br></div><div> -------------------------->poppler<br></div><div> -------------------------->qt4<br></div>
<div> -------------------------->test<br></div><div> -------------------------->utils<br></div><div> -------------------------->cmake_install.cmake<br></div><div> -------------------------->CMakeCache<br>
</div><div> -------------------------->config.h<br></div><div> -------------------------->CTestfile.cmake<br></div><div> -------------------------->libpoppler.dll <br></div><div> -------------------------->libpoppler.dll.a<br>
</div><div> -------------------------->Makefile<br></div><div> -------------------------->poppler.cbp<br></div><div> -------------------------->poppler.layout<br></div><div> <br></div><div>3) Now i need to link the poppler library to my project. Therefore in CodeBlocks I did the following:<br>
<br></div><div>a)Settings->Compiler->Linker settings: Link libraries<br></div><div> and I set the path to: C:\Users\Chris\Documents\Poppler\build\poppler-0.22.2_Build\libpoppler.dll.a<br><br></div><div>b)Then in Settings->Compiler->Search directories->Linker<br>
</div><div> I set the path to: C:\Users\Chris\Documents\Poppler\build\poppler-0.22.2_Build\</div><div><br></div><div>c)Then I set up the linking for my project:<br></div><div> Project->Build Options->Linker settings<br>
</div><div> and set the path to C:\Users\Chris\Documents\Poppler\build\poppler-0.22.2_Build\libpoppler.dll.a<br><br></div><div>d)And finally:<br> Project->Build Options->Search directories->Linker<br></div>
<div> and add the path: C:\Users\Chris\Documents\Poppler\build\poppler-0.22.2_Build\</div><div><br></div><div>4) I have now written the following code in my main.cpp just to see if everything works:<br><br><span style="color:rgb(53,28,117)"><span style="background-color:rgb(255,255,255)">1 : #include <iostream><br>
2 : #include "C:\Users\Chris\Documents\Poppler\build\poppler-0.22.2\cpp\poppler-global.h"<br>3 : #include "C:\Users\Chris\Documents\Poppler\build\poppler-0.22.2\cpp\poppler-document.h"<br>4 :<br>5 : using namespace std;<br>
6 :<br>7 : int main()<br>8 : {<br>9 :<br>10:<br>11: const string dir = "C:\\Users\\Chris\\Documents\\WorkForDad\\2013\\Pdf Automation\\Anotation Extraction\\Remuneration Report.pdf";<br>12:<br>13: poppler::document *doc = poppler::document::load_from_file(dir);<br>
14:<br>15: return 0;<br>16: }</span></span><br><br></div><div>However, I get the following error in my"Build messages" when I build the code:<br><br><br>C:\Users\Chris\Documents\WorkForDad\2013\Pdf Automation\Test\Clean\main.cpp||In function 'int main()':|<br>
C:\Users\Chris\Documents\WorkForDad\2013\Pdf Automation\Test\Clean\main.cpp|13|warning: unused variable 'doc' [-Wunused-variable]|<br>obj\Debug\main.o||In function `main':|<br>C:\Users\Chris\Documents\WorkForDad\2013\Pdf Automation\Test\Clean\main.cpp|13|undefined reference to `_imp___ZN7poppler8document14load_from_fileERKSsS2_S2_'|<br>
||=== Build finished: 1 errors, 1 warnings (0 minutes, 1 seconds) ===|<br> <br><br>###<br><br><br></div>And in the "Build log" I get the following:<br><br><br>-------------- Clean: Debug in Clean (compiler: GNU GCC Compiler)---------------<br>
<br>Cleaned "Clean - Debug"<br><br>-------------- Build: Debug in Clean (compiler: GNU GCC Compiler)---------------<br><br>mingw32-g++.exe -Wall -fexceptions -g -g -c "C:\Users\Chris\Documents\WorkForDad\2013\Pdf Automation\Test\Clean\main.cpp" -o obj\Debug\main.o<br>
C:\Users\Chris\Documents\WorkForDad\2013\Pdf Automation\Test\Clean\main.cpp: In function 'int main()':<br>C:\Users\Chris\Documents\WorkForDad\2013\Pdf Automation\Test\Clean\main.cpp:13:24: warning: unused variable 'doc' [-Wunused-variable]<br>
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 ..\..\..\..\..\Poppler\build\poppler-0.22.2_Build\libpoppler.dll.a C:\Users\Chris\Documents\Poppler\build\poppler-0.22.2_Build\libpoppler.dll.a <br>
obj\Debug\main.o: In function `main':<br>C:/Users/Chris/Documents/WorkForDad/2013/Pdf Automation/Test/Clean/main.cpp:13: <span style="color:rgb(53,28,117)"><b>undefined reference to `_imp___ZN7poppler8document14load_from_fileERKSsS2_S2_'</b></span><br>
collect2.exe: error: ld returned 1 exit status<br>Process terminated with status 1 (0 minutes, 1 seconds)<br>1 errors, 1 warnings (0 minutes, 1 seconds)<br> <br><br> <br>###<br><br><br></div><div>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
`_imp___ZN7poppler8document14load_from_fileERKSsS2_S2_'"<br><br></div><div>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. <br>
</div><div> <br></div><div>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.<br><br></div><div>Kind Regards<br>
</div><div>Chris<br></div><div><div><div><br></div></div></div></div>