c++ - TinyXML #include problem... Using libraries -
hey, i'm trying tinyxml @ least read file says "main.cpp:8: error: ‘tixmldocument’ not declared in scope"
this code im using:
tixmldocument("demo.xml");
ideally want read able read files , output xml tried code found online in 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 ); // defined later in tutorial } else { printf("failed load file \"%s\"\n", pfilename); } } int main(void) { dump_to_stdout("demo.xml"); return 0; }
and errors i'm getting are:
main.cpp: in function ‘void dump_to_stdout(const char*)’: main.cpp:13: error: cannot convert ‘tixmldocument*’ ‘const char*’ argument ‘1’ ‘void dump_to_stdout(const char*)’
if helps im on mac, ive tried compiling in terminal textmate. tried compile cpp files tinyxml separately before compiling main.cpp , have no idea why cant print out demo.xml let alone read it.
- it's called
tixmldocument
, nottixmldocument
- you can't call function haven't declared yet. since you're trying call undeclared overload of
dump_to_stdout
, compiler assumes want call version takesconst char *
, fails.
Comments
Post a Comment