Illegal reference to non-static member "Sun :: m_SunTexture"

I'm not too competent in C ++, and this compiler error just doesn't make sense to me. The following line causes a compiler error, indicated in the header:

m_SunTexture = LudoTextureManager::GetInstance()->GetTextureData(hardcoded.c_str()).m_Texture;

where m_SunTexture is defined in my header file as

IDirect3DTexture9 *m_SunTexture;

in the private section of my header file. Why is this! It makes no sense to me.

Here is more code, as required. m_SunTexture is called in this function

void Sun::DrawSun()
{
    std::wstring hardcoded = L"..\\Data\\sun.jpg";
    m_SunTexture = LudoTextureManager::GetInstance()->GetTextureData(hardcoded.c_str()).m_Texture;
    //more code here, cut off because it useless for this.
}

DrawSun is defined in the header file as follows:

static void DrawSun();

in the general section of my header file.

+3
source share
1 answer

, , "m_SunTexture".

. . , "this", ( ) .

+5

Source: https://habr.com/ru/post/1722287/


All Articles