const char* not accepted by function argument

Hi,
I am trying to use TinyXml to read and write xml.
I declared a string:
const char *TASK_FILE = "Tasks.xml"
and want to reference it in the TiXmlDocument constructor, but I get the following errors:
1
2
3
4
5
6
7
8
obj/Debug/main.o||In function `addTask(Task const&)':|
/home/kira/Projects/TaskMan/main.cpp|17|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 ===| 


The constructor is defined as:
TiXmlDocument( const char * documentName );

Thank you.

PS: I also tried to write this line:
TiXmlDocument doc("Tasks.xml");
but it's not accepted, returning same errors.
Last edited on
Those are linker errors, not compiler errors. Is the class yours, or part of a library?
class 'Task' is very simple. It is defined as follows:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef TASK_H_INCLUDED
#define TASK_H_INCLUDED
#endif

#include <iostream>
using namespace std;

class Task {
    string m_Task;
    bool m_Done;
    long m_Time;

    public:
        Task();
        Task(string task, bool done, long time);
        ~Task();

        string getTask() { return m_Task; }
        void setTask(string newTask) { m_Task = newTask; }

        bool getDone() { return m_Done; }
        void setDone(bool done) { m_Done = done; }

        long getTime() { return m_Time; }
        void setTime(long time) { m_Time = time; }
};


TinyXml is installed as a package by ArchLinux's package system. How can I solve it?

Thank you.
Add its library to the compiler options. I assume it must be something like -ltinyxml. For a library called libname.a, the option would be -lname. The library is probably in /usr/lib.
thank you. it solved my problems.
Topic archived. No new replies allowed.