Jump to content
  • Advertisement
Sign in to follow this  
nano511

Access Violation with SDL_PollEvent

This topic is 2541 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When my code gets to this line

if( SDL_PollEvent(&Event))


I get an access violation error. Can anyone tell me why?

Share this post


Link to post
Share on other sites
Advertisement
Is that a local variable, a global variable, a member variable? What kind of access violation are you getting? If you can't decide on what is relevant then try creating a minimal but complete code sample that demonstrates your problem: duplicate your project and start deleting code until you get down to the bare minimum amount that still has your issue.

Share this post


Link to post
Share on other sites
It is a member variables to an Input object.

And it cant be broken down any farther then that one line can it?

Share this post


Link to post
Share on other sites
And it cant be broken down any farther then that one line can it?
That line is not a complete program!

Share this post


Link to post
Share on other sites
...

I wont be able to make a 'test' program. There is nothing wrong with that line of code. I learned it from lazy foo's tutorials.

If i have more then one event structure is it bad?

E: here is the full error:

Unhandled exception at 0x681064ca in PaddleBattle.exe: 0xC0000005:
Access violation writing location 0xcdcdcdcd.


[continue]

Share this post


Link to post
Share on other sites
So you expect we can find an error in your code by looking at some peace of code that has nothing wrong with it? How could we?

You can have as many SDL_Events you want. Not that I see why you would need more than one. May I ask why?

Share this post


Link to post
Share on other sites
0xCDCDCDCD is a fill pattern used by MSVC for uninitialized memory. In other words you're probably accessing a pointer to somewhere that you haven't properly allocated. If you want more specific advice, I'd recommend creating a complete, but minimum code example as I've already explained.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!