Warum bin ich immer error C2061 (syntax error: identifier)?

Okay... ich habe wrestling dieser Fehler für mindestens eine Stunde jetzt. Ich habe meine StaticSprite Klasse Erben, von meinem Component-Klasse. Jedoch, wenn ich versuche zum instanziieren einer StaticSprite Instanz, ich bekomme Fehler-c2016.

Hier mein relevanter code, ich werde mehr posten, wenn es sein muss.
Vielen Dank im Voraus.

StaticSprite.h

#ifndef STATICSPRITE_H_
#define STATICSPRITE_H_

#include "Component.h"
#include <SFML/Graphics.hpp>
#include <string>

namespace GE
{
 class Entity;
 class Component;
 class StaticSprite : public Component
 {
 private:
  sf::Image image;
 public:
  sf::Sprite Sprite;
  StaticSprite();
  StaticSprite(std::string filename);
 };
}

#endif

Komponente.h

#ifndef COMPONENT_H_
#define COMPONENT_H_

#include "Entity.h"
#include "ComponentType.h"
#include <iostream>

namespace GE
{
 class Entity;
 class Component
 {
 protected:
  Entity* myEntity;
  TYPE type;
 public:
  Component();
  virtual ~Component() {}
  Entity* getEntity();
 };
}

#endif

main.cpp

int main(int argc, char* argv[])
{
    Entity Player;
    //The first arg is just a number, and the second is the 
    //actual component to add to the Entity's component array
    Player.addComponent(StaticSprite, new StaticSprite()); //error

    //application loop
}

Entity.cpp

//TYPE is just an enumerated type
void Entity::addComponent(TYPE type, void* component)
{
Components[type] = component;
}

ComponentType.h

#ifndef COMPONENTTYPE_H_
#define COMPONENTTYPE_H_

namespace GE
{
enum TYPE{Base = 0, StaticSprite, DynamicSprite, 
    Physics, Collision, Input, Particle, Audio, Scriptable, MaxType};  
}

#endif
Welche Zeile wird der Fehler entsprechen?
Können Sie zeigen Ihnen, wie Sie das Objekt instanziiert wird?
Welche Linie hast du den Fehler?

InformationsquelleAutor epicasian | 2010-11-21

Schreibe einen Kommentar