@Disch: Thanks alot :D I did as you say and this is the result I got:
#0 00401644 CGame::GetRenderer(this=0x0) (C:\Users\Lino\Documents\1 Data Lino\Freizeit\1 Programmieren\C++ & SDL2\C++\RunningMan\CGame.cpp:115)
#1 00401958 CSprite::Load(this=0x47703c, cPath=0x46e0f4 <_ZSt16__convert_from_vRKPiPciPKcz+4645108> "data/imgs/player/Ash_Sprite.bmp", R=255, G=0, B=255) (C:\Users\Lino\Documents\1 Data Lino\Freizeit\1 Programmieren\C++ & SDL2\C++\RunningMan\CSprite.cpp:22)
#2 0040183C CPlayer::Init(this=0x47703c) (C:\Users\Lino\Documents\1 Data Lino\Freizeit\1 Programmieren\C++ & SDL2\C++\RunningMan\CPlayer.cpp:13)
#3 0040152A CGame::OnInit(this=0x477020) (C:\Users\Lino\Documents\1 Data Lino\Freizeit\1 Programmieren\C++ & SDL2\C++\RunningMan\CGame.cpp:58)
#4 004016F3 SDL_main(argc=argc@entry=1, argv=argv@entry=0x330008) (C:\Users\Lino\Documents\1 Data Lino\Freizeit\1 Programmieren\C++ & SDL2\C++\RunningMan\CMain.cpp:8)
#5 0040232C console_main(argc=argc@entry=1, argv=argv@entry=0x330008) (../src/main/windows/SDL_windows_main.c:140)
#6 004024ED WinMain@16(hInst=0x400000, hPrev=0x0, szCmdLine=0x813e29 "", sw=10) (../src/main/windows/SDL_windows_main.c:177)
#7 0046B48B main () (??:??)
As far as I was doing debugging I have learnt to always fix the first error you get. Sometimes the other errors disappear along with the first one.
The first error here refers to the following function:
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 27 28 29 30 31
|
//CGame.h : I cut out the includes and the #ifndefs and #endifs
class CGame
{
public:
CGame();
bool OnInit();
void OnEvent(SDL_Event* Event);
void OnLoop(); //Data Updates
void OnRender();
void OnCleanup();
int GetScreenWidth();
int GetScreenHeight();
SDL_Renderer* GetRenderer(); //<--This is the first error
bool bRunning; //Yeah I know should be private
private:
int SCREEN_WIDTH;
int SCREEN_HEIGHT;
SDL_Window* MainWindow;
SDL_Renderer* MainRenderer; //Here is the Renderer
SDL_Surface* MainWindowSurface;
CPlayer Player;
};
|
1 2 3 4 5 6
|
//CGame.cpp: Here as well: everything cut down to this function
SDL_Renderer* CGame::GetRenderer()
{
return MainRenderer;
}
|
I guess that the primary error lies there… Because the next error refers to my “CSprite::Load()”-function, which makes use of the “CGame::GetRenderer()”-function. The next error is in my “CPlayer::Init()”-function where my “CSprite::Load()”-function is being called. The next error is in my “CGame::OnInit()”-function where my “CPlayer::Init()”-function is being called. The next error is in the “main”-function where my “CGame::OnInit()”-function is being called.
So basically my first error produces another error, which leads to another error …
I hope I got that right. I’m not sure whether it’s a problem with the pointers or with not using SDL correctly. (the second would have nothing to do with this forum)
Would be create if you could help me and explain me what I did wrong…
Thanks for all of your answers so far
Cheers HalfNOoB