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 pugixml.cpp
while compiling. Anyone knows how to add pugixml.cpp
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)
You can fix this by editing the file called pugiconfig.hpp
and uncommenting the line here:
// Uncomment this to switch to header-only version
//#define PUGIXML_HEADER_ONLY
Change it to:
// Uncomment this to switch to header-only version
#define PUGIXML_HEADER_ONLY
Now you don't need to include pugixml.cpp
directly, the header will become self-contained.