QTCreator: Chubbulus project help thread

The debugger gives me a SIGSEGV error when I run my application.

CONTEXT: My game project has a “game_state” variable that has 3 possible states: “start” for the title screen, “game” for the main gameplay and “end” for the game over. When the app is started, it is set to “start”. When I start the game, it shows a blank box (which would be the title screen however there is not one to show currently so its blank.) The player can press any button to start the game. This switches the game_state to “game” and would start the gameplay

However, once I press anything, the app crashes and the debugger gives me the SIGSEGV error.

Here is everything that shows up in the debugger section.


I’ve seen that this is a memory issue? How would I go about fixing this? (I’m very very new to OF and QT)

the crash is happening in player::draw() – I’d start there and comment out the whole draw call, then slowly bring lines back in to find the specific line that it’s crashing on.

also assuming this is the same code from github, you may need to have these items in your data folder

This is my entire Player draw

Also I have removed all of the additional code asside from player for now. I have it pointing to my own player sprite in the data file: falconDragoon.png

Could it be the filesize that’s the issue? Or am I barking up the wrong tree?

UPDATE: If I comment out the line in my player draw, it doesn’t crash. So the error is definitely in that one line like you suggested.

I think you should check if setup(…) is getting called, that’s where an image is getting passed through to Player. I’d work backwards from that…

Also, If I we’re you I’d start just with getting the code in GitHub to compile and run with the original images / fonts etc

(also, in case it’s helpful, I don’t 100% know if this is the best beginner code to be looking at to learn OF. Perhaps it may be easier to start with examples, and to compile those and to start to modify or adjust them. This is a fairly complex project…)

as a general strategy I find commenting out the inside of functions, and adding

cout << “HERE” << endl;

very helpful – you can see if code is getting called and it can help you figure out some logic issues, like a function not getting called, etc.

I generally just try to remove as much as a I can until it stops crashing then slowly bring things back in so I can find exact lines. then trace those variables backwards to see what issues there may be.

One small suggestion @Chubbulus - it might be easier to keep one forum thread going for the project you are trying to get working. ( I know someone else suggested opening a new topic but I think this is all connected to the same project ).

Good luck!
Glad to see you have got the project running ( if crashing sometimes ). :slight_smile:


How would I load the original code in QTCreator as a project? There is no qbs file included…

Is this a way of outputting to the Application Output section? If so I’ll take a look at doing that

I think you are running the code, but would guess your data folder is empty. You are missing the images and fonts this example is using.

cout prints to the console, which I guess here is called “application output”

I’ve gotten the original code to run, so I shall look through, change some stuff and experiment! Thanks for your help! I’ll reply here if I have any more questions!