小编Rob*_*bie的帖子

错误LNK2001:未解析的外部符号"private:static class

错误LNK2001:未解析的外部符号"private:static class irrklang :: ISoundEngine*GameEngine :: Sound :: _ soundDevice"(?_soundDevice @ Sound @ GameEngine @@ 0PAVISoundEngine @ irrklang @@ A)

我无法弄清楚为什么我收到这个错误.我相信我正在初始化.任何人都可以伸出援手吗?

sound.h

class Sound
{
private:
    static irrklang::ISoundEngine* _soundDevice;
public:
    Sound();
    ~Sound();

    //getter and setter for _soundDevice
    irrklang::ISoundEngine* getSoundDevice() { return _soundDevice; }
//  void setSoundDevice(irrklang::ISoundEngine* value) { _soundDevice = value; }
    static bool initialise();
    static void shutdown();
Run Code Online (Sandbox Code Playgroud)

sound.cpp

namespace GameEngine
{
Sound::Sound() { }
Sound::~Sound() { }

bool Sound::initialise()
{
    //initialise the sound engine
    _soundDevice = irrklang::createIrrKlangDevice();

    if (!_soundDevice) …
Run Code Online (Sandbox Code Playgroud)

c++ static-members linker-errors visual-c++

14
推荐指数
2
解决办法
4万
查看次数

标签 统计

c++ ×1

linker-errors ×1

static-members ×1

visual-c++ ×1