Tiny XML link error

I'm trying to compile a small program using Tiny XML:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
using namespace std;
#define TIXML_USE_SDL
#include <tinyxml.h>

void printNodes(TiXmlNode* node){
        while(node){
                cout << node->Value() << ": " << node->Type() << endl;
                printNodes(node->FirstChild());
                node = node->NextSibling();}}

int main(){
 TiXmlDocument doc("file.xml");
 if(!doc.LoadFile()){
        cerr << "Error opening file" << endl;
        return 1;}
 printNodes(&doc);
 return 0;}


But running this command:

g++ -l tinyxml test.cpp -o test


gives this error:

/tmp/ccSi29Op.o: In function `TiXmlString::quit()':
test.cpp:(.text._ZN11TiXmlString4quitEv[TiXmlString::quit()]+0xc): undefined reference to `TiXmlString::nullrep_'
collect2: ld returned 1 exit status


Any ideas?
Topic archived. No new replies allowed.