Moin Leute,
habe grade ein Problem mit dem Konstruktoraufruf meiner AdvancedSprite Klasse.
|
C-/C++-Quelltext
|
1
2
3
4
5
6
7
8
|
//_______ADVANCEDSPRITE_H_______//
class AdvancedSprite : public Animateable
{
public:
AdvancedSprite( AnimationSettings ani_settings ) : Animateable( ani_settings );
};
|
|
C-/C++-Quelltext
|
1
2
3
4
5
6
|
//_______ADVANCEDSPRITE_CPP_______//
AdvancedSprite::AdvancedSprite( AnimationSettings ani_settings ) : Animateable( ani_settings )
{
};
|
|
C-/C++-Quelltext
|
1
2
3
4
5
6
7
8
9
10
|
//_______ANIMATEABLE_H_______//
class Animateable : public sf::Sprite
{
public:
Animateable( AnimationSettings ani_settings );
};
|
|
C-/C++-Quelltext
|
1
2
3
4
5
6
7
|
//_______ANIMATEABLE_CPP_______//
Animateable::Animateable( AnimationSettings ani_settings )
{
};
|
Wenn ich das Programm so ausführen möchte, bekomme ich einige Fehlermeldungen:
|
Quellcode
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
18 IntelliSense: Es wurde eine "{" erwartet. c:\Users\Kay\Desktop\Visual Studio\Projekte\The Castaway Adventure II\The Castaway Adventure II\AdvancedSprite.h 13 80 The Castaway Adventure II
Fehler 1 error C2969: Syntaxfehler: ';': Definition der Memberfunktion endet nicht mit '}' c:\users\kay\desktop\visual studio\projekte\the castaway adventure ii\the castaway adventure ii\AdvancedSprite.h 13 1 The Castaway Adventure II
Fehler 13 error C2969: Syntaxfehler: ';': Definition der Memberfunktion endet nicht mit '}' c:\users\kay\desktop\visual studio\projekte\the castaway adventure ii\the castaway adventure ii\AdvancedSprite.h 13 1 The Castaway Adventure II
Fehler 5 error C2630: ';' in Liste gefunden, aber durch Trennzeichen getrennte Liste erforderlich C:\Users\Kay\Desktop\Visual Studio\Projekte\The Castaway Adventure II\The Castaway Adventure II\AdvancedSprite.cpp 6 1 The Castaway Adventure II
Fehler 15 error C2630: ';' in Liste gefunden, aber durch Trennzeichen getrennte Liste erforderlich C:\Users\Kay\Desktop\Visual Studio\Projekte\The Castaway Adventure II\The Castaway Adventure II\main.cpp 9 1 The Castaway Adventure II
Fehler 7 error C2614: 'AdvancedSprite': Unzulässige Elementinitialisierung: 'AdvancedSprite' ist weder Basis noch Element C:\Users\Kay\Desktop\Visual Studio\Projekte\The Castaway Adventure II\The Castaway Adventure II\AdvancedSprite.cpp 6 1 The Castaway Adventure II
Fehler 6 error C2612: Abschließendes 'Bezeichner' in Initialisierungsliste für Basisklasse/Elemente nicht zulässig C:\Users\Kay\Desktop\Visual Studio\Projekte\The Castaway Adventure II\The Castaway Adventure II\AdvancedSprite.cpp 6 1 The Castaway Adventure II
Fehler 11 error C2601: 'AdvancedSprite::update': Lokale Funktionsdefinitionen sind unzulässig C:\Users\Kay\Desktop\Visual Studio\Projekte\The Castaway Adventure II\The Castaway Adventure II\AdvancedSprite.cpp 17 1 The Castaway Adventure II
Fehler 17 error C2562: 'AdvancedSprite::AdvancedSprite': 'void'-Funktion gibt einen Wert zurück C:\Users\Kay\Desktop\Visual Studio\Projekte\The Castaway Adventure II\The Castaway Adventure II\main.cpp 69 1 The Castaway Adventure II
Fehler 16 error C2534: 'AdvancedSprite': Konstruktor kann kein Ergebnis zurückgeben C:\Users\Kay\Desktop\Visual Studio\Projekte\The Castaway Adventure II\The Castaway Adventure II\main.cpp 69 1 The Castaway Adventure II
Fehler 3 error C2275: 'AnimationSettings': Ungültige Verwendung dieses Typs als Ausdruck C:\Users\Kay\Desktop\Visual Studio\Projekte\The Castaway Adventure II\The Castaway Adventure II\AdvancedSprite.cpp 6 1 The Castaway Adventure II
Fehler 4 error C2146: Syntaxfehler: Fehlendes ')' vor Bezeichner 'ani_settings' C:\Users\Kay\Desktop\Visual Studio\Projekte\The Castaway Adventure II\The Castaway Adventure II\AdvancedSprite.cpp 6 1 The Castaway Adventure II
Fehler 9 error C2143: Syntaxfehler: Es fehlt ';' vor '{' C:\Users\Kay\Desktop\Visual Studio\Projekte\The Castaway Adventure II\The Castaway Adventure II\AdvancedSprite.cpp 6 1 The Castaway Adventure II
Fehler 10 error C2143: Syntaxfehler: Es fehlt ';' vor '{' C:\Users\Kay\Desktop\Visual Studio\Projekte\The Castaway Adventure II\The Castaway Adventure II\AdvancedSprite.cpp 12 1 The Castaway Adventure II
Fehler 14 error C2062: 'int'-Typ unerwartet C:\Users\Kay\Desktop\Visual Studio\Projekte\The Castaway Adventure II\The Castaway Adventure II\main.cpp 8 1 The Castaway Adventure II
Fehler 8 error C2059: Syntaxfehler: ')' C:\Users\Kay\Desktop\Visual Studio\Projekte\The Castaway Adventure II\The Castaway Adventure II\AdvancedSprite.cpp 6 1 The Castaway Adventure II
Fehler 2 error C2039: '{ctor}': Ist kein Element von 'AdvancedSprite' C:\Users\Kay\Desktop\Visual Studio\Projekte\The Castaway Adventure II\The Castaway Adventure II\AdvancedSprite.cpp 6 1 The Castaway Adventure II
Fehler 12 error C1004: Unerwartetes Dateiende gefunden. C:\Users\Kay\Desktop\Visual Studio\Projekte\The Castaway Adventure II\The Castaway Adventure II\AdvancedSprite.cpp 20 1 The Castaway Adventure II
|
Dann habe ich den Konstruktor von AdvancedSprite in der header definiert und die Definition in der AdvancedSprite.cpp gelöscht.
|
C-/C++-Quelltext
|
1
2
3
4
5
6
7
8
9
10
11
12
|
//_______ADVANCEDSPRITE_H_______//
class AdvancedSprite : public Animateable
{
public:
AdvancedSprite( AnimationSettings ani_settings ) : Animateable( ani_settings ){};
~AdvancedSprite();
void update();
};
|
Und siehe da. Es klappt.
Aber wiso funktioniert es in der AdvancedSprite.cpp nicht
Mit freundlichen Grüßen,
Maxo