我的運氣很可能是非常明顯的東西,從我身邊溜走了,但我一直在C2143掙扎了很長一段時間,我很難過。Vs2012編譯器錯誤C2143:丟失;之前*
game.h(21): error C2143: syntax error : missing ';' before '*'
game.h(21): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Game.h
#ifndef GAME_H_
#define GAME_H_
#include <irrlicht.h>
using namespace irr;
using namespace irr::core;
using namespace irr::scene;
using namespace irr::video;
using namespace irr::io;
using namespace irr::gui;
#include <iostream>
#include "CInput.h"
#include "CAssets.h"
using namespace rtsirr;
IrrlichtDevice *device = 0;
IVideoDriver *driver = 0;
ISceneManager *manager = 0;
CAssets *assets = 0; // Line 21, error here
#endif
CAssets.h
#ifndef ASSETS_H_
#define ASSETS_H_
#include "Game.h"
namespace rtsirr {
class CAssets
{
public:
CAssets();
virtual ~CAssets();
ITexture* getTexture(stringw name);
IMesh* getMesh(stringw name);
IAnimatedMesh* getAnimatedMesh(stringw name);
void load();
private:
map<stringw, ITexture *> *textures;
map<stringw, IMesh *> *meshes;
map<stringw, IAnimatedMesh *> *animatedMeshes;
};
}
#endif
似乎CAssets沒有被識別爲有效的類型,但我想不出爲什麼。是什麼導致了這個問題?
謝謝。
我可以問一個有點相關的問題嗎?在**頭文件***中,所有那些變量decl都在做什麼? – WhozCraig
@WhozCraig好點!將它們更改爲_extern_。 – pajm