Beim Versuch, meinen Code mit der aktuellen Signatur in g ++ zu kompilieren, wird eine Fehlermeldung angezeigt:
cannot declare member function static void Foo::Bar(std::ostream&, const Foo::Node*) to have static linkage
Meine Frage ist zweifach:
Signaturen waren immer mein Tod, wenn ich C++ verwendete
Bearbeiten: Hier ist auch die Klassenheader-Datei:
class Foo {
public:
Foo();
~Foo();
bool insert(const Foo2 &v);
Foo * find(const Foo2 &v);
const Foo * find(const Foo2 &v) const;
void output(ostream &s) const;
private:
//Foo(const Foo &v);
//Foo& operator =(const Foo &v);
//Not implemented; unneeded
struct Node {
Foo2 info;
Node *left;
Node *right;
};
Node * root;
static bool insert(const Foo2 &v, Node *&p);
static void output(ostream &s, const Node *p);
static void deleteAll(Node *p);
Ich vermute, Sie haben etwas getan wie:
class Foo
{
static void Bar();
};
...
static void Foo::Bar()
{
...
}
Das "static void Foo::Bar
"ist falsch. Sie brauchen nicht das zweite" static
".