No debugging symbols in gdb even when compiling with -g flag

delaccount992 picture delaccount992 · Dec 31, 2010 · Viewed 42k times · Source

I am trying to compile my program with debugging symbols for use in gdb. I have added the -g flag to my makefile but I still get "Reading symbols from ...(no debugging symbols found)" when I load the program in gdb. What is wrong??

Here is a stripped down example of my makefile which should have the relevant bits:

CPP = g++
CFLAGS = -c -g -Wall

$(BIN): $(OBJ)
 $(CPP) $(LDFLAGS) $(OBJ) -o $(BIN) $(LIBS)

<test.o>: <test.cpp>
 $(CPP) $(CFLAGS) <test.cpp> -o <test.o>

If you'd like to see the whole thing you can go here instead, though I don't think it's necessary:

http://pastebin.com/vGNjy0ga

Miscellaneous notes.. I'm compiling with MinGW on Windows and I have SFML and OpenGL as dependencies.

And no, the -s flag is nowhere to be found in my makefile.

Answer

delaccount992 picture delaccount992 · Dec 31, 2010

Ahh. I'm very sorry. It turns out the "clean:" portion of my makefile is broken. Thus when I used make clean nothing happened. Deleting the .o files manually fixed the problem. The flags work perfectly now. Thanks to everyone who posted anyway! This can be deleted now.