You need to provide definitions for in one source file. I suggest you modify shared.h to look like this...
Code: Select all
// ...
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
using namespace irrklang;
namespace api
{
extern SIrrlichtCreationParameters params;
extern IrrlichtDevice *device;
extern ISoundEngine* engine;
extern IVideoDriver* driver;
extern ISceneManager* smgr;
extern IGUIEnvironment* guienv;
extern ITimer* pTimer;
extern u32 uLastTime;
extern ICameraSceneNode* camera;
extern u32 uCurrentTime;
extern u32 uElapsedTime;
}
// ...
Code: Select all
#include "shared.h"
namespace api
{
SIrrlichtCreationParameters params;
IrrlichtDevice *device = 0;
ISoundEngine* engine = 0;
IVideoDriver* driver = 0;
ISceneManager* smgr = 0;
IGUIEnvironment* guienv = 0;
ITimer* pTimer = 0;
u32 uLastTime = 0;
ICameraSceneNode* camera = 0;
u32 uCurrentTime = 0;
u32 uElapsedTime = 0;
}
- Avoid using global variables, if you really need them, wrap them up in an object and pass that around, make it global, or use a singleton/monostate pattern.
- Don't put using namespace clauses in headers.
- Read a C++ book.