This is probably a newbish type of question but I was wondering if anyone out there new.
Why is it possible in SDL that when creating an SDL_Surface you are forced to create it as a pointer? If you try to create it without making your var a pointer it will give an error. Why is this? Is there a way when I create classes I can force all object to be pointers only?
I have virtually no experience with GUI programming but your problem sounds vaguely similar to mine when setting up wxWidgets (both SDL and wxWidgets use the Zlib library so I'm guessing they're somewhat similar). If it's the same problem I had you may have installed the wrong version of SDL for your system and need to install an older/newer version, or update the appropriate library(ies).
Of course it could likely be something completely different so maybe someone with more experience can offer other possibilities. Some code would help too.
Why is it possible in SDL that when creating an SDL_Surface you are forced to create it as a pointer?
It's C's way of enforcing encapsulation. SDL_Surface is a black box. It has some members that you can access, but it has other members that are "hidden" and created in a super-secret special way.
Creating a SDL_Surface without using SDL's API (like Peter's post illustrates) may compile, but it is a BAD IDEA because the SDL_Surface object can never work properly. You are bypassing all the behind-the-scenes initialization that SDL has to set up to get the Surface created properly.
It's the same reason fopen() and similar functions return a FILE* pointer rather than you just creating a FILE object yourself.