[libxml++] Error using example code of libxml++
- From: "M. F." <rossino al gmail com>
- To: libxmlplusplus-general lists sourceforge net
- Subject: [libxml++] Error using example code of libxml++
- Date: Wed, 17 Feb 2010 15:41:05 +0100
Hello,
I'm trying to install libxml + +
on Windows XP operating system.
When I try to run the following example code in a
project MS VC 2005:
----------------------------------------------------------------------------------------------------
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <libxml++/libxml++.h>
#include <libxml++/parsers/textreader.h>
#include <iostream>
struct indent {
int depth_;
indent(int depth): depth_(depth) {};
};
std::ostream & operator<<(std::ostream & o, indent const & in)
{
for(int i = 0; i != in.depth_; ++i)
{
o << " ";
}
return o;
}
int
main(int argc, char* argv[])
{
try
{
xmlpp::TextReader reader("example.xml");
while(reader.read())
{
int depth = reader.get_depth();
std::cout << indent(depth) << "--- node ---" << std::endl;
std::cout << indent(depth) << "name: " << reader.get_name() << std::endl;
std::cout << indent(depth) << "depth: " << reader.get_depth() << std::endl;
if(reader.has_attributes())
{
std::cout << indent(depth) << "attributes: " << std::endl;
reader.move_to_first_attribute();
do
{
std::cout << indent(depth) << " " << reader.get_name() << ": " << reader.get_value() << std::endl;
} while(reader.move_to_next_attribute());
reader.move_to_element();
}
else
{
std::cout << indent(depth) << "no attributes" << std::endl;
}
if(reader.has_value())
std::cout << indent(depth) << "value: '" << reader.get_value() << "'" << std::endl;
else
std::cout << indent(depth) << "novalue" << std::endl;
}
}
catch(const std::exception& e)
{
std::cout << "Exception caught: " << e.what() << std::endl;
}
}
-----------------------------------------------------------------------------------
I get some Link error:
- error LNK2019: unresolved external symbol "public: __thiscall xmlpp::TextReader::TextReader(class Glib::ustring const &)" (??0TextReader xmlpp@@QAE ABVustring@Glib@@@Z) referenced in function _main main.obj
- error LNK2019: unresolved external symbol "public: bool __thiscall xmlpp::TextReader::has_attributes(void)const " (?has_attributes TextReader@xmlpp@@QBE_NXZ) referenced in function _main main.obj
- error LNK2019: unresolved external symbol "public: bool __thiscall xmlpp::TextReader::has_value(void)const " (?has_value TextReader@xmlpp@@QBE_NXZ) referenced in function _main main.obj
and other similar errors. Please Help Me!!!!
Thanks
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]