Hey, I'm really trying to get TinyXML to at least read the file, but it says: "main.cpp: 8: error:" TiXMLDocument has not been declared in this area "
This is the im code using:
TiXMLDocument("demo.xml");
Ideally, I want to read the ability to read files and output XML, so I also tried this code, which I found online in the tutorial
#include <iostream>
#include "tinyxml.h"
#include "tinystr.h"
void dump_to_stdout(const char* pFilename)
{
TiXmlDocument doc(pFilename);
bool loadOkay = doc.LoadFile();
if (loadOkay)
{
printf("\n%s:\n", pFilename);
dump_to_stdout( &doc );
}
else
{
printf("Failed to load file \"%s\"\n", pFilename);
}
}
int main(void)
{
dump_to_stdout("demo.xml");
return 0;
}
And now I get the following errors:
main.cpp: In function ‘void dump_to_stdout(const char*)’:
main.cpp:13: error: cannot convert ‘TiXmlDocument*’ to ‘const char*’ for argument ‘1’ to ‘void dump_to_stdout(const char*)’
If that helps im on mac, ive tried compiling in terminal as well as in textmate. I also tried to compile the cpp files for TinyXML separately before compiling main.cpp, and I have no idea why I cannot print demo.xml, not to mention reading it.
source
share