I'm not sure why but when it fails, this is the bit of code it points too. Hoever I don't see anything wrong with it. and it doesn't give me any warnings or anything. the error i get is
Unhandled exception at 0x00b213d3 in firstRPG.exe: 0xC0000005: Access violation reading location 0xcccccccc.
Unhandled exception at 0x00b213d3 in firstRPG.exe: 0xC0000005: Access violation reading location 0xcccccccc.
If you're getting this error then it's not when you try to compile, silly.
Best guess: mainEvent is uninitialized at line 4.
Correction:
1 2 3 4 5 6 7 8
//mainEvent must be an 'SDL_Event', not an 'SDL_Event *'!
while (!quit){
//More than one event may have accumulated since the last call to SDL_PollEvent()!
while (SDL_PollEvent(&mainEvent) && mainEvent.type != SDL_QUIT);
if (mainEvent.type == SDL_QUIT)
break;
//...
}
Thanks, I what is odd is that I was following a tutorial video and matched my code perfectly with his and even eventually used his source code and it still didn't work for me, but worked for him. but i got frustrated and just stopped that project. its a little over my head at this point anyways.
Oftentimes, the compiler may "point" to a function stating that it is causing an error, when in fact, the actual problem is somewhere else.
I wouldn't actually give up on this, but sometimes printing your code onto paper instead of staring at the screen will help. I do this all the time, when I need to refactor my code, or fix hard-to-find problems.