所以我为这些Weapon类的构造函数提供了这个代码:
Weapon(const WeaponsDB * wepDB);
Weapon(const WeaponsDB * wepDB_, int * weaponlist);
~Weapon(void);
Run Code Online (Sandbox Code Playgroud)
而且我一直收到错误:
1>c:\users\owner\desktop\bosconian\code\bosconian\weapon.h(20) : error C2062: type 'int' unexpected
Run Code Online (Sandbox Code Playgroud)
和随之而来的错误(超过列出的):
1>c:\users\owner\desktop\bosconian\code\bosconian\weapon.h(21) : error C2059: syntax error : '('
1>c:\users\owner\desktop\bosconian\code\bosconian\weapon.h(21) : error C2238: unexpected token(s) preceding ';'
1>c:\users\owner\desktop\bosconian\code\bosconian\weapon.h(33) : error C2327: '<unnamed-tag>::maxWeapons' : is not a type name, static, or enumerator
1>c:\users\owner\desktop\bosconian\code\bosconian\weapon.h(33) : error C2065: 'maxWeapons' : undeclared identifier
1>c:\users\owner\desktop\bosconian\code\bosconian\weapon.h(38) : warning C4094: untagged 'class' declared no symbols
Run Code Online (Sandbox Code Playgroud)
我是一个半新手,我无法弄明白.
第21行是第二个构造函数,第一个构造函数不会导致错误.另外,如果我注释掉这个构造函数,我仍然会在构造函数之后列出所有错误.知道问题可能是什么?
以下是上面的代码供参考:
#ifndef Weapon
#define Weapon
#include <allegro.h>
#include <stdio.h>
#include <iostream>
using namespace std;
class WeaponsDB;
class MenuDriver;
class Ammo;
class Weapon
{
public:
.....
Run Code Online (Sandbox Code Playgroud)
Ana*_*tts 19
#ifndef Weapon
#define Weapon
Run Code Online (Sandbox Code Playgroud)
这几乎肯定会导致奇怪; 调用常量WEAPON_H代替.