Why is Codeblocks terminating my program with Status 3?

Oct 15, 2012 at 4:49am
I'm programming with SDL and CodeBlocks. The problem I have is when I initialize
a surface the program crashes...every time. It actually comes on for a split
second...and then crashes

Here is my initialization:

message = TTF_RenderText_Solid(funnyFont, "25", textColor);


- where message is a pointer to create a surface
- program runs fine when I take the message initialization out

I have used this a million times and have never had this problem. The only
difference is the program that this initialization belongs is pretty big. Can
anyone tell what the problem is. Thanks.

Oct 15, 2012 at 5:02am
I haven't ever had this problem/I have never used codeblocks so not exactly sure what the problem is.

You should double check to make sure your font was loaded in correctly.
You could also try TTF_GetError()/SDL_GetError() to see if they provide any useful info.

1
2
3
4
if(!(message = TTF_RenderText_Solid(funnyFont, "25", textColor))
{
      cout << TTF_GetError() << endl;
}


It may also be a problem with another part of your code that is interfering, hard to tell.
Oct 15, 2012 at 5:02am
Yay. One line of code. May favorite thing to debug.

Maybe you should provide a little more context.
Oct 15, 2012 at 5:14am
@James2250

*muffs head*
Thanks! I did not even initialize funnyFont. Program runs smooth


...always those little things. lol @ cire. Those tend to be the best learning experiences...
at least for me.
Topic archived. No new replies allowed.