Witam.
Chcę w klasie CGameObject mam zmienną static CGame * game. Chciałbym ustawic ją w trakcie działania programu, a później za pomocą const_cast dodać jej specyfiaktor const. Robię to w ten sposób:
void CGameObject::SetCGamePtr(CGame * ptr)
{
game = ptr;
const_cast<CGame * const>(game);
}
Niestety, kompilator protestuje podczas linkowania:
1>Linking...
1>snake_data.obj : error LNK2020: unresolved token (0A000336) "public: static class CGame * CGameObject::game" (?game@CGameObject@@2PAVCGame@@A)
1>mouse.obj : error LNK2020: unresolved token (0A00037E) "public: static class CGame * CGameObject::game" (?game@CGameObject@@2PAVCGame@@A)
1>LongerGameObject.obj : error LNK2020: unresolved token (0A000303) "public: static class CGame * CGameObject::game" (?game@CGameObject@@2PAVCGame@@A)
1>GameMgr.obj : error LNK2020: unresolved token (0A00032D) "public: static class CGame * CGameObject::game" (?game@CGameObject@@2PAVCGame@@A)
1>cgameobject.obj : error LNK2020: unresolved token (0A00000C) "public: static class CGame * CGameObject::game" (?game@CGameObject@@2PAVCGame@@A)
1>snake_data.obj : error LNK2001: unresolved external symbol "public: static class CGame * CGameObject::game" (?game@CGameObject@@2PAVCGame@@A)
1>cgameobject.obj : error LNK2001: unresolved external symbol "public: static class CGame * CGameObject::game" (?game@CGameObject@@2PAVCGame@@A)
1>GameMgr.obj : error LNK2001: unresolved external symbol "public: static class CGame * CGameObject::game" (?game@CGameObject@@2PAVCGame@@A)
1>LongerGameObject.obj : error LNK2001: unresolved external symbol "public: static class CGame * CGameObject::game" (?game@CGameObject@@2PAVCGame@@A)
1>mouse.obj : error LNK2001: unresolved external symbol "public: static class CGame * CGameObject::game" (?game@CGameObject@@2PAVCGame@@A)
1>C:\makro\cp\snake cv++\snake na VC++ -wersja robocza\Debug\bgi.exe : fatal error LNK1120: 6 unresolved externals
1>Build log was saved at "file://c:\makro\cp\snake cv++\snake na VC++ -wersja robocza\Debug\BuildLog.htm"
1>bgi - 11 error(s), 0 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Możecie pomóc? :-)
EDIT:
Post do usunięcia, problem leżał w dużej literze linijki wczesniej...