Champika Champika - 1 year ago 339
C++ Question

Qt undefined reference to `pugi::xml_document::xml_document()`

Recently I'm working on a project with Qt/C++/xml and some other stuff. I have to get some string values form a xml file. For that I'm using

#include "pugixml.hpp"

But when i'm using
pugi::xml_document document;
, it give an error as follow.

undefined reference to 'pugi::xml_document::xml_document()'

As I saw in this link I have to use
while compiling. Anyone knows how to add
to Qt project?

I'm using,

Qt Creator 4.0.2
Based on Qt 5.7.0 (GCC 4.9.1 20140922(Red Hat 4.9.1-10), 63 bit)

Answer Source

I believe this error is a linker error. That means you have added the function declaration but not the function definition.

Therefore, download 'pugixml' and list the pugixml.cpp source file in QT. The function definition should be inside this .cpp file.

Then your compiler will be able to find the definition of the function.

It should solve the issue.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download