I'm trying to compile a project utilizing QT and LibXMl++. I'm having trouble messing around with the cmake file. I'm getting undefined references to libxml++ while compiling my code.
Here is the snippet in the cmake file pertaining to libXML++:
#libxml++
find_package (PkgConfig REQUIRED)
find_package (LibXml2 REQUIRED)
pkg_check_modules (LIBXMLXX REQUIRED IMPORTED_TARGET libxml++-5.0)
target_link_libraries(PkgConfig::LIBXMLXX)
link_directories("/usr/lib64/")
include_directories("/usr/include/libxml++-5.0/")
The libXML++ source is located at: /usr/include/libxml++-5.0/libxml++
, and I see the .so file located at /usr/lib64/libxml++5.0.so
Main.cpp:
#include "downloader.h"
#include <libxml++/libxml++.h>
#include <iostream>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
try {
xmlpp::DomParser parser;
parser.set_validate();
}
catch(const std::exception& ex) {
std::cerr << "Exception caught: " << ex.what() << std::endl;
return EXIT_FAILURE;
}
Downloader d;
d.doDownload();
return a.exec();
}
Compiler output:
main.cpp:11: error: undefined reference to `xmlpp::DomParser::DomParser()'
main.cpp:12: undefined reference to `xmlpp::Parser::set_validate(bool)'
main.cpp:14: undefined reference to `xmlpp::DomParser::~DomParser()'
collect2: error: ld returned 1 exit status
Compiled in QT Creator 9.0.2