0

I've been able to install the library, but when I try to declare a new document I get this error.

undefined reference to 'duckx::Document::Document(std::string)''

I used the example given on their GitHub.

I am using the following command line to compile

g++ -o main.exe main.cpp -L "DuckX\build\Debug" -lduckx -I "DuckX/include" -I "DuckX/thirdparty/pugixml" -I "DuckX/thirdparty/zip" -D_SSIZE_T -D_GLIBCXX_USE_CXX11_ABI=0
  • 2
    I'm guessing you didn't link to the duckx library – Alan Birtles Jan 14 '22 at 08:33
  • @AlanBirtles I did link the library. I was able to declare a new object with the default constructor, but when I try to open my .docx I get that error. – Lucian Andrita Jan 14 '22 at 08:40
  • *Linking* or *`#include` a header file*? Those are two different things. – Some programmer dude Jan 14 '22 at 08:41
  • @Someprogrammerdude Linking. I'm new to using this kind of library. Here's the way I run it. `g++ -L "DuckX\build\Debug" -I "DuckX/include -I "pugixml/src" -I "zip/src" -lduckx` – Lucian Andrita Jan 14 '22 at 08:48
  • Order of files and libraries on the command line is important, libraries (like `-lduckx`) needs to come *after* the source or object files. Since you don't show the full command line (with the source/object file listed) I can only assume it is last, after the library. Change the order. – Some programmer dude Jan 14 '22 at 08:52
  • @Someprogrammerdude It was my fault, I somehow missed that when writing the comment. I do have the library after the source file. `g++ main.cpp -L "DuckX\build\Debug" -I "DuckX/include -I "pugixml/src" -I "zip/src" -lduckx` – Lucian Andrita Jan 14 '22 at 08:57
  • 1
    I'd guess you've somehow compiled duckx with the [old c++ ABI](https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html) – Alan Birtles Jan 14 '22 at 14:51
  • @AlanBirtles Thank you for your idea! I've done some research and I compiled the code with the old ABI and now I have fewer errors (right now it cannot find the std::string in the same constructor) – Lucian Andrita Jan 17 '22 at 07:12
  • Why `-D_SSIZE_T`? – Alan Birtles Jan 17 '22 at 07:45
  • @AlanBirtles There were some issues with some previous declarations in the zip.h 3rd party library. – Lucian Andrita Jan 17 '22 at 07:47

0 Answers0