OOP and SDL problems

Started by
3 comments, last by Crusable77 11 years, 4 months ago
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
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.
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.
If you have a compiler error you should probably post the relevant code as well as the actual compiler error.
I fixed it so its okay

This topic is closed to new replies.

Advertisement