Compiler Giving Me Wacko Errors

My computer is giving me some errors that make me fear for it's mental health. They all seem to follow the following pattern:

/usr/include/c++/4.6/bits/stl_tree.h|1068|multiple definition of `<some variable>'

At the moment it is saying metal is the thing that has a multiple definition, but if I get rid of metal entirely from my project, it starts complaining about currentElement. Metal is an object of the element class, and currentElement is a pointer to one of elements (At the moment there is only metal).

Now, if you have a look at what is on the lines it is complaining about, you will see why I am considering sending my computer to get some psychological help.

This is line 1068 of stl_tree.h

_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::

And this is what exists where it says it is first defined

value = valueIn;

It appears to have something to do with the element class because the supposed first definition is in a function for the class:

1
2
3
4
5
6
7
void element::defValues(unsigned char valueIn, unsigned char redIn, unsigned char greenIn, unsigned char blueIn)
{
    value = valueIn;
    red   = redIn;
    green = greenIn;
    blue  = blueIn;
}


Thanks for any help
This is often cause by one of three things: failure to use include guards, using macros that conflict with std library symbols, or defining symbols/types used by the std library. It is illegal, for example, for you to define symbols or macros that start with one or two underscores; they could conflict with the compiler or std library symbols.

The fun part is that the source of these sorts of problems are rarely where the compiler raises the error.
Topic archived. No new replies allowed.