我正在尝试封装基于sprite的游戏,但我无法访问具有相同命名空间的类。 以下是命名空间的代码:
namespace Client
{
public class Bomb : public Entity
{
private:
int tiempo;
TipoBomba tipo;
public:
Bomb(int px, int py, int tiempo, TipoBomba tipo);
int getX();
int getY();
int getTiempo();
void setTiempo(int t);
Client::TipoBomba getTipo();
void reducirTiempo();
void Mostrar(Graphics ^ gr);
void explotar(Graphics ^ gr);
};
public class Game
{
int nivel;
LivingEntity* objJugador;
//Enemigo* objEnemigo;
public:
~Game(void);
Game(void);
static int ** matriz;
static std::vector<Bomb*> bombas;
static bool isBloque(int px, int py);
static bool isVacio(int px, int py);
static void romperBloque(int px, int py, Graphics^ gr);
static bool isRompible(int px, int py);
static bool isBomba(int px, int py);
Point getPrimeraPosicionJugador();
static void addBomba(Bomb* b);
static void cargarMatriz();
void setDireccion_Jugador(Direccion dir);
void Crear_Enemigo(int px, int py);
void Crear_Jugador(int px, int py);
void Mover_Entidades(Graphics^ gr);
Client::Player* getJugador();
int getNivel();
void setNivel(int n);
};
public class Player : public LivingEntity
{
int vidas;
int bombas;
public:
Player(void);
Player(int px, int py);
void Mostrar(Graphics^ gr);
void Mover(Graphics^ gr);
int getVidas();
int getBombas();
void setBombas(int bombas);
void setVidas(int vidas);
};
public class Enemy : public LivingEntity
{
public:
~Enemy(void);
Enemy(void);
Enemy(int px, int py);
void Mover(Graphics^ gr);
void Mostrar(Graphics^ gr);
};
public enum TipoBomba
{
BASICA,
GRANDE
};
}
警告是:
Warning 60 warning C4183: 'getJugador': missing return type; assumed to be a member function returning 'int'
Warning 37 warning C4183: 'getTipo': missing return type; assumed to be a member function returning 'int'
错误是:
Error 6 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Error 10 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
我尝试从Client :: Player更改为Player(与TipoBomba相同)并且它不起作用。我也尝试在课前公开,但仍然一样。我需要使用任何类型的关键字,还是命名空间语义?。谢谢
编辑:
一切正常,无论是谁,现在我在编译时都会遇到很多LINKER错误。例子:
Error 10 error LNK2005: "public: __thiscall Entity::Entity(int,int,char *,int,int)" (??0Entity@@$$FQAE@HHPADHH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Enemy.obj BombermanUPC
Error 26 error LNK2005: "public: __thiscall Entity::Entity(int,int,char *,int,int)" (??0Entity@@$$FQAE@HHPADHH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Game.obj BombermanUPC
Error 42 error LNK2005: "public: __thiscall Entity::Entity(int,int,char *,int,int)" (??0Entity@@$$FQAE@HHPADHH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\MyForm.obj BombermanUPC
Error 58 error LNK2005: "public: __thiscall Entity::Entity(int,int,char *,int,int)" (??0Entity@@$$FQAE@HHPADHH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Player.obj BombermanUPC
Error 2 error LNK2005: "public: __thiscall Entity::Entity(int,int,char *,int,int)" (??0Entity@@QAE@HHPADHH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Enemy.obj BombermanUPC
Error 18 error LNK2005: "public: __thiscall Entity::Entity(int,int,char *,int,int)" (??0Entity@@QAE@HHPADHH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Game.obj BombermanUPC
Error 34 error LNK2005: "public: __thiscall Entity::Entity(int,int,char *,int,int)" (??0Entity@@QAE@HHPADHH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\MyForm.obj BombermanUPC
Error 50 error LNK2005: "public: __thiscall Entity::Entity(int,int,char *,int,int)" (??0Entity@@QAE@HHPADHH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Player.obj BombermanUPC
Error 13 error LNK2005: "public: __thiscall LivingEntity::LivingEntity(int,int,char *,int,int)" (??0LivingEntity@@$$FQAE@HHPADHH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Enemy.obj BombermanUPC
Error 29 error LNK2005: "public: __thiscall LivingEntity::LivingEntity(int,int,char *,int,int)" (??0LivingEntity@@$$FQAE@HHPADHH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Game.obj BombermanUPC
Error 45 error LNK2005: "public: __thiscall LivingEntity::LivingEntity(int,int,char *,int,int)" (??0LivingEntity@@$$FQAE@HHPADHH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\MyForm.obj BombermanUPC
Error 61 error LNK2005: "public: __thiscall LivingEntity::LivingEntity(int,int,char *,int,int)" (??0LivingEntity@@$$FQAE@HHPADHH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Player.obj BombermanUPC
Error 5 error LNK2005: "public: __thiscall LivingEntity::LivingEntity(int,int,char *,int,int)" (??0LivingEntity@@QAE@HHPADHH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Enemy.obj BombermanUPC
Error 21 error LNK2005: "public: __thiscall LivingEntity::LivingEntity(int,int,char *,int,int)" (??0LivingEntity@@QAE@HHPADHH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Game.obj BombermanUPC
Error 37 error LNK2005: "public: __thiscall LivingEntity::LivingEntity(int,int,char *,int,int)" (??0LivingEntity@@QAE@HHPADHH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\MyForm.obj BombermanUPC
Error 53 error LNK2005: "public: __thiscall LivingEntity::LivingEntity(int,int,char *,int,int)" (??0LivingEntity@@QAE@HHPADHH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Player.obj BombermanUPC
Error 14 error LNK2005: "public: enum Direccion __thiscall LivingEntity::getMovimiento(void)" (?getMovimiento@LivingEntity@@$$FQAE?AW4Direccion@@XZ) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Enemy.obj BombermanUPC
Error 30 error LNK2005: "public: enum Direccion __thiscall LivingEntity::getMovimiento(void)" (?getMovimiento@LivingEntity@@$$FQAE?AW4Direccion@@XZ) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Game.obj BombermanUPC
Error 46 error LNK2005: "public: enum Direccion __thiscall LivingEntity::getMovimiento(void)" (?getMovimiento@LivingEntity@@$$FQAE?AW4Direccion@@XZ) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\MyForm.obj BombermanUPC
Error 62 error LNK2005: "public: enum Direccion __thiscall LivingEntity::getMovimiento(void)" (?getMovimiento@LivingEntity@@$$FQAE?AW4Direccion@@XZ) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Player.obj BombermanUPC
Error 6 error LNK2005: "public: enum Direccion __thiscall LivingEntity::getMovimiento(void)" (?getMovimiento@LivingEntity@@QAE?AW4Direccion@@XZ) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Enemy.obj BombermanUPC
Error 22 error LNK2005: "public: enum Direccion __thiscall LivingEntity::getMovimiento(void)" (?getMovimiento@LivingEntity@@QAE?AW4Direccion@@XZ) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Game.obj BombermanUPC
Error 38 error LNK2005: "public: enum Direccion __thiscall LivingEntity::getMovimiento(void)" (?getMovimiento@LivingEntity@@QAE?AW4Direccion@@XZ) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\MyForm.obj BombermanUPC
Error 54 error LNK2005: "public: enum Direccion __thiscall LivingEntity::getMovimiento(void)" (?getMovimiento@LivingEntity@@QAE?AW4Direccion@@XZ) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Player.obj BombermanUPC
Error 11 error LNK2005: "public: int __thiscall Entity::getX(void)" (?getX@Entity@@$$FQAEHXZ) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Enemy.obj BombermanUPC
Error 27 error LNK2005: "public: int __thiscall Entity::getX(void)" (?getX@Entity@@$$FQAEHXZ) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Game.obj BombermanUPC
Error 43 error LNK2005: "public: int __thiscall Entity::getX(void)" (?getX@Entity@@$$FQAEHXZ) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\MyForm.obj BombermanUPC
Error 59 error LNK2005: "public: int __thiscall Entity::getX(void)" (?getX@Entity@@$$FQAEHXZ) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Player.obj BombermanUPC
Error 3 error LNK2005: "public: int __thiscall Entity::getX(void)" (?getX@Entity@@QAEHXZ) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Enemy.obj BombermanUPC
Error 19 error LNK2005: "public: int __thiscall Entity::getX(void)" (?getX@Entity@@QAEHXZ) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Game.obj BombermanUPC
Error 35 error LNK2005: "public: int __thiscall Entity::getX(void)" (?getX@Entity@@QAEHXZ) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\MyForm.obj BombermanUPC
Error 51 error LNK2005: "public: int __thiscall Entity::getX(void)" (?getX@Entity@@QAEHXZ) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Player.obj BombermanUPC
Error 12 error LNK2005: "public: int __thiscall Entity::getY(void)" (?getY@Entity@@$$FQAEHXZ) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Enemy.obj BombermanUPC
Error 28 error LNK2005: "public: int __thiscall Entity::getY(void)" (?getY@Entity@@$$FQAEHXZ) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Game.obj BombermanUPC
Error 44 error LNK2005: "public: int __thiscall Entity::getY(void)" (?getY@Entity@@$$FQAEHXZ) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\MyForm.obj BombermanUPC
Error 60 error LNK2005: "public: int __thiscall Entity::getY(void)" (?getY@Entity@@$$FQAEHXZ) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Player.obj BombermanUPC
Error 4 error LNK2005: "public: int __thiscall Entity::getY(void)" (?getY@Entity@@QAEHXZ) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Enemy.obj BombermanUPC
Error 20 error LNK2005: "public: int __thiscall Entity::getY(void)" (?getY@Entity@@QAEHXZ) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Game.obj BombermanUPC
Error 36 error LNK2005: "public: int __thiscall Entity::getY(void)" (?getY@Entity@@QAEHXZ) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\MyForm.obj BombermanUPC
Error 52 error LNK2005: "public: int __thiscall Entity::getY(void)" (?getY@Entity@@QAEHXZ) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Player.obj BombermanUPC
Error 15 error LNK2005: "public: void __thiscall LivingEntity::setDx(int)" (?setDx@LivingEntity@@$$FQAEXH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Enemy.obj BombermanUPC
Error 31 error LNK2005: "public: void __thiscall LivingEntity::setDx(int)" (?setDx@LivingEntity@@$$FQAEXH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Game.obj BombermanUPC
Error 47 error LNK2005: "public: void __thiscall LivingEntity::setDx(int)" (?setDx@LivingEntity@@$$FQAEXH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\MyForm.obj BombermanUPC
Error 63 error LNK2005: "public: void __thiscall LivingEntity::setDx(int)" (?setDx@LivingEntity@@$$FQAEXH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Player.obj BombermanUPC
Error 7 error LNK2005: "public: void __thiscall LivingEntity::setDx(int)" (?setDx@LivingEntity@@QAEXH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Enemy.obj BombermanUPC
Error 23 error LNK2005: "public: void __thiscall LivingEntity::setDx(int)" (?setDx@LivingEntity@@QAEXH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Game.obj BombermanUPC
Error 39 error LNK2005: "public: void __thiscall LivingEntity::setDx(int)" (?setDx@LivingEntity@@QAEXH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\MyForm.obj BombermanUPC
Error 55 error LNK2005: "public: void __thiscall LivingEntity::setDx(int)" (?setDx@LivingEntity@@QAEXH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Player.obj BombermanUPC
Error 16 error LNK2005: "public: void __thiscall LivingEntity::setDy(int)" (?setDy@LivingEntity@@$$FQAEXH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Enemy.obj BombermanUPC
Error 32 error LNK2005: "public: void __thiscall LivingEntity::setDy(int)" (?setDy@LivingEntity@@$$FQAEXH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Game.obj BombermanUPC
Error 48 error LNK2005: "public: void __thiscall LivingEntity::setDy(int)" (?setDy@LivingEntity@@$$FQAEXH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\MyForm.obj BombermanUPC
Error 64 error LNK2005: "public: void __thiscall LivingEntity::setDy(int)" (?setDy@LivingEntity@@$$FQAEXH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Player.obj BombermanUPC
Error 8 error LNK2005: "public: void __thiscall LivingEntity::setDy(int)" (?setDy@LivingEntity@@QAEXH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Enemy.obj BombermanUPC
Error 24 error LNK2005: "public: void __thiscall LivingEntity::setDy(int)" (?setDy@LivingEntity@@QAEXH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Game.obj BombermanUPC
Error 40 error LNK2005: "public: void __thiscall LivingEntity::setDy(int)" (?setDy@LivingEntity@@QAEXH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\MyForm.obj BombermanUPC
Error 56 error LNK2005: "public: void __thiscall LivingEntity::setDy(int)" (?setDy@LivingEntity@@QAEXH@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Player.obj BombermanUPC
Error 17 error LNK2005: "public: void __thiscall LivingEntity::setMovimiento(enum Direccion)" (?setMovimiento@LivingEntity@@$$FQAEXW4Direccion@@@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Enemy.obj BombermanUPC
Error 33 error LNK2005: "public: void __thiscall LivingEntity::setMovimiento(enum Direccion)" (?setMovimiento@LivingEntity@@$$FQAEXW4Direccion@@@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Game.obj BombermanUPC
Error 49 error LNK2005: "public: void __thiscall LivingEntity::setMovimiento(enum Direccion)" (?setMovimiento@LivingEntity@@$$FQAEXW4Direccion@@@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\MyForm.obj BombermanUPC
Error 65 error LNK2005: "public: void __thiscall LivingEntity::setMovimiento(enum Direccion)" (?setMovimiento@LivingEntity@@$$FQAEXW4Direccion@@@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Player.obj BombermanUPC
Error 9 error LNK2005: "public: void __thiscall LivingEntity::setMovimiento(enum Direccion)" (?setMovimiento@LivingEntity@@QAEXW4Direccion@@@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Enemy.obj BombermanUPC
Error 25 error LNK2005: "public: void __thiscall LivingEntity::setMovimiento(enum Direccion)" (?setMovimiento@LivingEntity@@QAEXW4Direccion@@@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Game.obj BombermanUPC
Error 41 error LNK2005: "public: void __thiscall LivingEntity::setMovimiento(enum Direccion)" (?setMovimiento@LivingEntity@@QAEXW4Direccion@@@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\MyForm.obj BombermanUPC
Error 57 error LNK2005: "public: void __thiscall LivingEntity::setMovimiento(enum Direccion)" (?setMovimiento@LivingEntity@@QAEXW4Direccion@@@Z) already defined in Bomb.obj C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Player.obj BombermanUPC
Error 69 error LNK2019: unresolved external symbol "public: int __thiscall Client::Bomb::getX(void)" (?getX@Bomb@Client@@$$FQAEHXZ) referenced in function "public: static bool __cdecl Client::Game::isBomba(int,int)" (?isBomba@Game@Client@@$$FSA_NHH@Z) C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Game.obj BombermanUPC
Error 70 error LNK2019: unresolved external symbol "public: int __thiscall Client::Bomb::getY(void)" (?getY@Bomb@Client@@$$FQAEHXZ) referenced in function "public: static bool __cdecl Client::Game::isBomba(int,int)" (?isBomba@Game@Client@@$$FSA_NHH@Z) C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Game.obj BombermanUPC
Error 71 error LNK2019: unresolved external symbol "public: static void __cdecl Client::Game::addBomba(class Client::Bomb *)" (?addBomba@Game@Client@@$$FSAXPAVBomb@2@@Z) referenced in function "private: void __clrcall BombermanUPC::MyForm::Key_Press(class System::Object ^,class System::Windows::Forms::KeyEventArgs ^)" (?Key_Press@MyForm@BombermanUPC@@$$FA$AAMXP$AAVObject@System@@P$AAVKeyEventArgs@Forms@Windows@4@@Z) C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\MyForm.obj BombermanUPC
Error 68 error LNK2028: unresolved token (0A000107) "public: static void __cdecl Client::Game::addBomba(class Client::Bomb *)" (?addBomba@Game@Client@@$$FSAXPAVBomb@2@@Z) referenced in function "private: void __clrcall BombermanUPC::MyForm::Key_Press(class System::Object ^,class System::Windows::Forms::KeyEventArgs ^)" (?Key_Press@MyForm@BombermanUPC@@$$FA$AAMXP$AAVObject@System@@P$AAVKeyEventArgs@Forms@Windows@4@@Z) C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\MyForm.obj BombermanUPC
Error 66 error LNK2028: unresolved token (0A00047F) "public: int __thiscall Client::Bomb::getX(void)" (?getX@Bomb@Client@@$$FQAEHXZ) referenced in function "public: static bool __cdecl Client::Game::isBomba(int,int)" (?isBomba@Game@Client@@$$FSA_NHH@Z) C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Game.obj BombermanUPC
Error 67 error LNK2028: unresolved token (0A000480) "public: int __thiscall Client::Bomb::getY(void)" (?getY@Bomb@Client@@$$FQAEHXZ) referenced in function "public: static bool __cdecl Client::Game::isBomba(int,int)" (?isBomba@Game@Client@@$$FSA_NHH@Z) C:\Users\Martin\documents\visual studio 2013\Projects\BombermanUPC\BombermanUPC\Game.obj BombermanUPC
答案 0 :(得分:0)
C ++编译器逐行评估事物。 (这是一个过于简单化,但足够接近这个讨论。)当它到达声明getJugador
的那一行时,它对Client::Player
类型一无所知,因为它没有&#t; t到了那儿!
有几种方法可以解决这个问题:
public class Player : public LivingEntity;
告诉编译器&#34;有一个名为Player的类,我将声明后面的内容&#34;。 #include
需要任何其他类定义。只要您没有任何循环引用,就可以处理它。其他事项:
Graphics^
,因此您可以在此处使用C ++ / CLI。鉴于此,我高度高度建议你让你的课程管理。将类定义为public ref class
,并始终将变量和参数声明为MyClass^
。