John Smith
John Smith

Reputation: 41

C++ SDL segmentation fault

I had my game working and then decided to try and implement a menu using the following tutorial.

I did not use the tutorial to create the game that was in prior tutorials that he created.

Whenever I compile and run the program it loads briefly, then closes and says Process terminated with status 3 (0 minutes, 1 seconds) in the build log of code::blocks.

UPDATE: I have updated the code for the pastebin link to what I have now, the error I am now getting from the debugger is

Program received signal SIGSEGV, Segmentation fault.
In TTF_SizeUNICODE () (E:\game\pong\bin\Debug\SDL_ttf.dll)
At E:\game\pong\main.cpp:27

UPDATE 2: Seems that I embarrasingly didn't have the font installed. I've installed the font & now the debugger gets to a point where the screen displays with the font of "Start" and "Exit", however, immediately after doing this the program freezes, no error's what so ever in the debuggger, and if I run the program normally, it just stops responding after the text is displayed, strange. Just realised after forcefully closing the window after launching the program from code::blocks, it returns this: Process terminated with status -805306369 (0 minutes, 13 seconds).

UPDATE 3: Solved.

Upvotes: 0

Views: 2272

Answers (1)

Eugen Constantin Dinca
Eugen Constantin Dinca

Reputation: 9130

You're not initializing screen (line 220) before you're passing it to showMenu (line 224). AFAIK SDL_SetVideoMode returns a surface you could use for your screen.

Upvotes: 3

Related Questions