You are not logged in.
Pages: 1
Hi,
I installed TinyXml using a PKGBUILD file from the AUR.
I use codeblocks to develop in C++, but when I run the following, I get errors:
#include <tinyxml.h>
#include "task.h"
#include <time.h>
using namespace std;
int main() {
Task one("Sistemare il pc", false, time(NULL));
cout << one.getTask();
return 0;
}
void addTask(const Task &task) {
TiXmlDocument doc();
doc.LoadFile("Tasks.xml", TIXML_ENCODING_UTF8);
}
Here are errors I got:
In function 'void addTask(const Task&)'
error: request for member 'LoadFile' in 'doc', which is of non-class type 'TiXmlDocument()'
||=== Build finished: 1 errors, 0 warnings ===|
I am a beginner in C++, I always used C# and ASP.NET and want to try C++ also.
Thank you.
Last edited by hkproj (2010-06-06 11:59:11)
Offline
Usually it's a good idea to give more information than "It gives an error." If you have console output about the error, please post it. Put it in code tags if it's long so it's not too hard to read.
I've never used TinyXML before, so I don't have much of an idea without the error message. Especially if it has an error running and not when you're compiling it.
If it is an error in compiling, make sure that you include iostream, that has cin and cout defined in it if whatever else you're including doesn't define its own.
Last edited by jac (2010-06-06 11:17:35)
Offline
Sorry i forgot to write them:
|In function 'void addTask(const Task&)'
error: request for member 'LoadFile' in 'doc', which is of non-class type 'TiXmlDocument()'
I get other erorrs when I specify the file in the constructor:
#include <tinyxml.h>
#include "task.h"
#include <time.h>
using namespace std;
int main() {
Task one("Sistemare il pc", false, time(NULL));
cout << one.getTask();
return 0;
}
void addTask(const Task &task) {
TiXmlDocument doc("Tasks.xml");
}
Here are the errors:
obj/Debug/main.o||In function `addTask(Task const&)':|
/home/user/Projects/TaskMan/main.cpp|14|undefined reference to `TiXmlDocument::TiXmlDocument(char const*)'|
obj/Debug/main.o||In function `TiXmlString::quit()':|
/usr/include/tinystr.h|255|undefined reference to `TiXmlString::nullrep_'|
obj/Debug/main.o||In function `~TiXmlDocument':|
/usr/include/tinyxml.h|1402|undefined reference to `vtable for TiXmlDocument'|
/usr/include/tinyxml.h|1402|undefined reference to `TiXmlNode::~TiXmlNode()'|
||=== Build finished: 4 errors, 0 warnings ===|
Last edited by hkproj (2010-06-06 11:22:53)
Offline
Ok i solved. I forgot to link the library.
Offline
Pages: 1