Correct way to install external dependencies in CodeBlocks ... | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 3

Correct way to install external dependencies in CodeBlocks ...

I am trying to install DynaPDF (a free PDF manipulation library) in CodeBlocks. I got a .msi file which installed the package containing dlls, static libs and headers in my computer. But that didn't link the package with the Compiler in CodeBlocks, and so I tried the following to do so: 0) Add the include folder of the installed directory to the Search Directories / Compiler ( In CodeBlocks, one finds this in - Compiler/Search Directories/Compiler/ - and Add...) 1) Add the linker folder for libraries to the Search Directories / Linker ( In CodeBlocks, one finds this in - Compiler/Search Directories/Linker/ - and Add...) 2) Add the .dll files present in the bin folder again to the System32 and SysWOW64 folder in C:\\Windows 3) Add the static libs (.lib, .a) to - Compiler/Linker Settings/ Link Libraries - in CodeBlocks. Even after doing all this, I still get: H:/All C++ Files/SDL Interface/PDF Check/a.cpp:13: undefined reference to `__imp_pdfNewPDF' H:/All C++ Files/SDL Interface/PDF Check/a.cpp:16: undefined reference to `__imp_pdfSetOnErrorProc' H:/All C++ Files/SDL Interface/PDF Check/a.cpp:17: undefined reference to `__imp_pdfCreateNewPDFA' H:/All C++ Files/SDL Interface/PDF Check/a.cpp:18: undefined reference to `__imp_pdfSetPageCoords' H:/All C++ Files/SDL Interface/PDF Check/a.cpp:19: undefined reference to `__imp_pdfAppend' H:/All C++ Files/SDL Interface/PDF Check/a.cpp:20: undefined reference to `__imp_pdfSetFontA' H:/All C++ Files/SDL Interface/PDF Check/a.cpp:21: undefined reference to `__imp_pdfWriteFTextA' H:/All C++ Files/SDL Interface/PDF Check/a.cpp:22: undefined reference to `__imp_pdfEndPage' H:/All C++ Files/SDL Interface/PDF Check/a.cpp:23: undefined reference to `__imp_pdfCloseFile' H:/All C++ Files/SDL Interface/PDF Check/a.cpp:24: undefined reference to `__imp_pdfDeletePDF' So, what is the correct way to link libraries to CodeBlocks for use? I have the same error in installing SDL libraries as well.

12th Aug 2017, 7:26 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
1 Antwort
+ 1
Here is the program (The supplied sample in readme) Im using : #include"dynapdf.h" #include<cstdio> using namespace DynaPDF; SI32 PDF_CALL PDFError(const void* Data, SI32 ErrCode, const char* ErrMessage, SI32 ErrType) { printf("%s\n", ErrMessage); return 0; // Any other return value break processing } // Place a button on the form and double click on it. Add the following // code to the function. int main(int argc, char* argv[]) { void* pdf = pdfNewPDF(); // Create a new PDF instance if (!pdf) return 2; // Out of memory? // Set the error callback first pdfSetOnErrorProc(pdf, NULL, PDFError); pdfCreateNewPDF(pdf, "c:/myfirst.pdf"); pdfSetPageCoords(pdf, pcTopDown); // We use top-down coordinates pdfAppend(pdf); pdfSetFont(pdf, "Arial", fsItalic, 40.0, true, cp1252); pdfWriteFText(pdf, taCenter, "My first C++ output!"); pdfEndPage(pdf); pdfCloseFile(pdf); // Close the file and free all used resources pdfDeletePDF(pdf); // Do not forget to delete the PDF instance }
12th Aug 2017, 7:27 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar