Seg Fault in Code::Blocks but not from command line

I'm new to code::blocks. I have a simple project, only two source files, a header and a bitmap. I never told code::blocks what to do, just let it put in its default values. The issue is, it creates a binary that seg faults when calling the SDL2 library function IMG_LoadTexture.

I created a hand coded makefile that builds the project and it works as expected: no seg fault.

Is there a way I can get code::blocks to create a makefile so that I may see exactly what it's using for parameters to g++?

code::blocks->Selected Compiler (GNU GCC Compiler)
code::blocks->Compiler flags (Produce debugging symbols [-g])
code::blocks->Linker settings (SDL2 SDL2_image SDL2_ttf)

makefile by hand here:
all : main.o SdlSetup.o
	g++ -g main.o SdlSetup.o -o go -lSDL2_image -lSDL2_ttf -lSDL2

main.o : main.cpp
	g++ -g -c main.cpp

SdlSetup.o : SdlSetup.cpp
	g++ -g -c SdlSetup.cpp

clean :
	rm -rf *.o
	rm go
closed account (Dy7SLyTq)
code::blocks generates a makefile. i havent used it in a while, but you can either
a) set the arguments it passes to gcc yourself
b) i think you can have it use your own makefile
Maybe I'm dense, but if your code compiles, I don't think the issue is in the makefile.

What is the code you have to load an image, do you make sure that the image was actually loaded? If your code uses relative paths, there might be a problem with the directory that Code::Blocks puts the binary.
Topic archived. No new replies allowed.