What does this warnig mean?

This warning comes up when I try to compile.

The lines of code are:
1
2
3
4
5
6
7
8
9
10
11
12
static TextureManager* TextureManager::s_pInstance = 0;

static TextureManager* TextureManager::Instance()
{
    if (s_pInstance == 0)
    {
        s_pInstance = new TextureManager();
        return s_pInstance;
    }

    return s_pInstnace;
}


TextureManager.cpp:3:49: error: cannot declare member function ‘static TextureManager* TextureManager::Instance()’ to have static linkage [-fpermissive]
 static TextureManager* TextureManager::Instance()
Last edited on
it might help to see your code.
I c why this doesn't work. Why is it like that?
TextureManager.cpp: In static member function ‘static TextureManager* TextureManager::Instance()’:
TextureManager.cpp:14:12: error: ‘s_pInstnace’ was not declared in this scope
     return s_pInstnace;


I get that output when compiling it goes with this line and this is the header respectively:

1
2
3
4
5
6
7
8
9
10
TextureManager* TextureManager::Instance()
{
    if (s_pInstance == 0)
    {
        s_pInstance = new TextureManager();
        return s_pInstance;
    }

    return s_pInstnace;
}


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class TextureManager
{
    public:

        ~TextureManager() {}


        static TextureManager* Instance();
        bool load(std::string fileName, std::string id,
                SDL_Renderer* pRenderer);

//draw
        void draw(std::string id, int x, int y, int width, int height,
            SDL_Renderer* pRenderer, SDL_RendererFlip flip = SDL_FLIP_NONE);

//drawframe
        void drawFrame(std::string id, int x, int y, int width, int height,
            int currentRow, int currentFrame, SDL_Renderer* pRenderer,
            SDL_RendererFlip flip = SDL_FLIP_NONE);
    private:
        TextureManager() {}
        std::map<std::string, SDL_Texture*> m_textureMap;
        static TextureManager* s_pInstance;
};

typedef TextureManager TheTextureManager;
nvm, i Just noticed I mispelled the variable.

Sorry new to c++ so I was thinking incorrectly when trying to solve this compilation error.
Using a newer compiler or a lint tool might help you catch typos like that.
Topic archived. No new replies allowed.