reference to 'Column is ambiguous

hi all,
I'm using GCC 4.8.1 and I want to implement a XML parser using TinyXML and port it to AngelScript
now, it says:
reference to 'Column' is ambiguous
I've declared a class called xml_parser and I've added everything of tinyxml as it's public member
when I call Column(), and also Row(), it give's this error
what should I do?
this is it's code:
xml_parser.hpp:
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
27
28
29
30
31
32
33
34
35
36
#ifndef AGK_XML_PARSER_H
#define AGK_XML_PARSER_H

#define TIXML_USE_STL
#include <tinyxml.h>

/*
*this class parse's XML files
*/
class xml_parser: public TiXmlBase, TiXmlDocument, TiXmlElement, TiXmlDeclaration, TiXmlAttribute, TiXmlHandle, TiXmlNode, TiXmlText, TiXmlUnknown
{
public:
void load(wchar_t*);
void save(wchar_t*);
int get_column();
int get_row();
bool has_error();
int get_error_id();
wchar_t* get_error_discription();
int get_error_column();
int get_error_row();
void clear_errors();
void set_tab_size(int);
void set_string(wchar_t*, wchar_t*);
void set_int(wchar_t*, int);
void set_double(wchar_t*, double);
void remove(wchar_t*);
int get_int(wchar_t*);
wchar_t* get_string(wchar_t*);
double get_double(wchar_t* name);
wchar_t* get_version();
wchar_t* get_encoding();
wchar_t* get_standalone();
};

#endif 

xml_parser.cpp:
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#include "xml_parser.hpp"

void xml_parser::load(wchar_t* filename)
{
LoadFile( (char*) filename);
}

void xml_parser::save(wchar_t* filename)
{
SaveFile((char*) filename);
}

int xml_parser::get_column()
{
return Column();
}

int xml_parser::get_row()
{
return Row();
}

bool xml_parser::has_error()
{
return Error();
}

int xml_parser::get_error_id()
{
return ErrorId();
}

wchar_t* xml_parser::get_error_discription()
{
return (wchar_t*) ErrorDesc();
}

int xml_parser::get_error_column()
{
return ErrorCol();
}

int xml_parser::get_error_row()
{
return ErrorRow();
}

void xml_parser::clear_errors()
{
ClearError();
}

void xml_parser::set_tab_size(int size)
{
SetTabSize(size);
}

void xml_parser::set_string(wchar_t* name, wchar_t* str)
{
SetAttribute((char*) name, (char*) str);
}

void xml_parser::set_int(wchar_t* name, int val)
{
SetAttribute((char*) name, val);
}

void xml_parser::set_double(wchar_t* name, double val)
{
SetDoubleAttribute((char*) name, val);
}

void xml_parser::remove(wchar_t* name)
{
RemoveAttribute((char*) name);
}

int xml_parser::get_int(wchar_t* name)
{
int i;
Attribute((char*) name, &i);
return i;
}

wchar_t* xml_parser::get_string(wchar_t* name)
{
return (wchar_t*) Attribute((char*) name);
}

double xml_parser::get_double(wchar_t* name)
{
double d;
Attribute((char*) name, &d);
return d;
}

wchar_t* xml_parser::get_version()
{
return (wchar_t*) Version();
}

wchar_t* xml_parser::get_encoding()
{
return (wchar_t*) Encoding();
}

wchar_t* xml_parser::get_standalone()
{
return (wchar_t*) Standalone();
}

thanks in advance
Last edited on
Nowhere in your code have you shown us the declarations or definitions for entities named "Row" or "Column", so there's no way we can identify any ambiguities.
Last edited on
Column and Row are in the TiXmlBase class
but another thing that I've noticed is, boath of them are public members
now a problem occurred is that error!
where is this problem?
Are you sure one or more of your other base classes doesn't also contain methods with those names.

You're inheriting from nine different base classes! That can't possibly be right. Why do you think you need to inherit from so many? That's bound to cause you problems, and I'm sure you must have misunderstood something.
Row() and Column are declared in the TiXmlBase class
but a thing that I've noticed is how ever, boath of them are public
My guess would be that some of those other 8 classes you're inheriting also inherit from TiXmlBase. That's where the ambiguity is occurring.

You've completely ignored the questions I asked in my last post. I'll reiterate: Nine is an insane number of classes to inherit from. In nearly 20 years of C++ programming, I've never seen anyone try to write a class that directly inherits from that many classes. Are you absolutely certain you haven't misunderstood something?

If you're dead set on doing something as crazy as this, then you need to go and read up on the difficulties of multiple inheritance, and in particular, look at virtual inheritance.
boath Column() and Row() functions are declared inside TiXmlBase class and boath are public
What is this?
1
2
3
class xml_parser: public TiXmlBase, TiXmlDocument, TiXmlElement,
                                    TiXmlDeclaration, TiXmlAttribute, TiXmlHandle, 
                                    TiXmlNode, TiXmlText, TiXmlUnknown


Why are you privately inheriting from all these different base classes? Each of which in turn inherits directly or indirectly from TiXmlBase.

Have you had a look at the inheritance hierarchy?
http://www.grinninglizard.com/tinyxmldocs/classTiXmlBase.html
boath Column() and Row() functions are declared inside TiXmlBase class and boath are public

Now you're just repeating yourself. Are you actually bothering to read the posts other people are making? JLBorges and I have both explained where the problem is - it's that several of the classes you're inheriting from also inherit from TiXmlBase, so there are multiple "instances" of those methods.
Last edited on
so, what is your idea, what should I do?
I need just 1 class in order to port it to AngelScript
now, what should I do for it to work?
I've never used tinyxml, so I don't know. That's why I was asking you those questions, which you didn't bother to answer. If you refuse to tell me the things I'm trying to find out, then there's no way I can help you.

Don't worry, I'm not taking it personally. You didn't bother to answer JLBorges either, when he asked you similar questions.
Last edited on
I've inherited these, because I want to implement just one class!
do you know something better than tinyxml?
But why do you think your class needs to inherit from all of them?

Do you know what inheritance means?

Do you understand what type of relationship inheritance is intended to model?

I'd recommend you do some more reading and learning about inheritance. It can be tricky to understand, and a good textbook or tutorial should help you out a lot.
Last edited on
> do you know something better than tinyxml?

TinyXML-2 is said to be better http://www.grinninglizard.com/tinyxml2docs/index.html


> I've inherited these, because I want to implement just one class!

Use composition. Something along these lines:

1
2
3
4
5
6
7
8
9
10
11
12
class xml_parser
{
    public:
        void load( std::string filename ) { xmldoc.LoadFile( filename.c_str() ) ; }
        
        // ...
        
    private: 
        XmlDocument xmldoc ;    
        XmlNode* current_node = nullptr ;
        // ...
};
can I use expat?
I think it is better than tinyxml
i know what is inheritance
i didn't know that all the classes use TiXmlBase as there inheritance members
i read the documentations very bad and very carelessly!
this is because of lag of my eyesight
thanks a lot,
now,
what is your idea about expat?
expat is better or tinyxml?
Last edited on
> what is your idea about expat?

Expat is a stream-oriented XML parser written in C. It had a declining user base because there were no new releases for about five years or so, till 2012.

TinyXML has limited functionality and poor performance, but it is by far the easiest XML parser to use.

You might want to take a look at pugixml https://code.google.com/p/pugixml/
It is a fairly easy to use C++ XML library.
Last edited on
Topic archived. No new replies allowed.