• Advertisement
Sign in to follow this  

OOP and SDL problems

This topic is 1881 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

Hello, i am trying to setup a class for handling everything in my program so that the my main.cpp isn't cluttered. However i have some SDL_Surfaces that i need to use in different member functions of the class, but the program crashed when i defined them in the class and then initialize them in the constructor. So i initialize them in the class as const static SDL_Surfaces; I still got an error saying i need to have a const member to initialize them in the class. Could someone please show me a different method, or fix my method. Thanks Edited by Mathew Bergen

Share this post


Link to post
Share on other sites
Advertisement

... but the program crashed when i defined them in the class and then initialize them in the constructor. So i initialize them in the class as const static SDL_Surfaces; I still got an error saying i need to have a const member to initialize them in the class....

Sounds to me like you're attempting to use SDL before initializing SDL.

Share this post


Link to post
Share on other sites
I initialized it in my constructor, but when the SDL_Surfaces are in the constructor it cannot find them through tho rest of the class, that's why i need help, i'm not sure what to do to fix it.

Share this post


Link to post
Share on other sites
If you have a compiler error you should probably post the relevant code as well as the actual compiler error.

Share this post


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

  • Advertisement