|
From: Per W. <pw...@ia...> - 2003-06-13 11:46:12
|
You didn't exactly send any source code for us to look at... However, if you get multiple declarations of _pGame, I would suspect that one header file contains a line 'GameEngine *pGame;' or similar. If that include file is used by more than one cpp file (main.cpp and GameEngine.cpp) then you'll get a link error. In the header, the declaration should say 'extern GameEngine *pGame;' and then in one of the source files, there should be a 'GameEngine *pGame;'. Is GameEngine::m_pGameEngine declared as static? In that case, you should declare a variable of that type in one of the cpp files. /Per W On Fri, 13 Jun 2003, Vlada Djurovic wrote: > Hi. > > I just got a book about games programming and I got stuck in the first step. > When trying to compile an example from the book, I keep getting linker > errors. The output looks like this: > > C:\Visual\engine\main.o > [Warning] In function `GameEngine::GetFrameDelay(void)': > //C/Visual/engine/main.cpp(.bss+0x0) C:\Visual\engine\main.cpp(.bss+0x0) > multiple definition of `_pGame' > //C/Visual/engine/GameEngine.h C:\Visual\engine\skeleton.o(.bss+0x0) > first defined here > C:\Visual\engine\GameEngine.o > [Warning] In function `_10GameEngineP11HINSTANCE__PcT2UsUsii': > > [Linker error] undefined reference to `GameEngine::m_pGameEngine' > > > I can't figure out what this means. I tried looking for multiple definitions > of _pGame, but I can't find any. Can something else be causing this? > As for the other error, m_pGameEngine is a member of GameEngine class and > it's referenced only in the class constructor. Can somebody give me a hint > about possible problems? > > Thanks. > ------------ > Vlada > > > > ------------------------------------------------------- > This SF.NET email is sponsored by: eBay > Great deals on office technology -- on eBay now! Click here: > http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5 > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |