在gdb中没有调试符号,即使使用-g标志进行编译 [英] No debugging symbols in gdb even when compiling with -g flag
问题描述
我试图编译我的程序与调试符号在gdb中使用。我已经添加了-g标志到我的makefile,但我仍然得到阅读符号从...(没有调试符号发现)当我加载程序在gdb。什么是错误
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??
这是一个我的makefile的一个例子,它应该有相关的位:
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:
其他注意事项..我在Windows上使用MinGW进行编译,并且将SFML和OpenGL作为依赖项。
Miscellaneous notes.. I'm compiling with MinGW on Windows and I have SFML and OpenGL as dependencies.
不,-s标志在我的makefile中找不到。
And no, the -s flag is nowhere to be found in my makefile.
推荐答案
我非常抱歉。结果是我的makefile的clean:部分被破坏了。因此,当我使用make clean没有发生。手动删除.o文件解决问题。标志现在完美。感谢大家谁发布反正!这可以立即删除。
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.
这篇关于在gdb中没有调试符号,即使使用-g标志进行编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!