解决gdb调试报错“No symbol table is loaded. Use the "file" command.”
2015-04-16 14:48
711 查看
linux下写的Makefile,然后编译成文件,gdb调试的时候用list命令报错.搞了半天,在网上找了很多,说是一定要用-g,
然而我是添加的,后来又有人说是需要把-g写调宏定义CFLAGS = -g,但是还是不对.最后经过自己的摸索,才发现,如果
是.c的文件,用CFLAGS是可以的,但是如果是.cpp文件,则必须使用CPPFLAGS = -g才可以
贴上代码如下
CPP = g++ ##这里用gcc或者是g++都没有影响
CPPFLAGS = -g# -D_REENTRANT -DDEBUG -lpthread ##如果这里是cpp文件,一定用CPPFLAGS,如果是.c文件,一定用CFLAGS
OBJS = hello.o judge.o
PROG = hello
.PHONY : all clean
all:$(PROG)
$(PROG):$(OBJS)
$(CPP) $(CPPFLAGS) -o $(PROG) $(OBJS)
#也可以写成下面这样,这样就不用考试是用CFLAGS,或者是CPPFLAGS了,不过这样每次都会编译所有的文件,会消耗内在
#hello:hello.cpp judge.cpp
# gcc $(CFLAGS) -o hello hello.cpp judge.cpp
然而我是添加的,后来又有人说是需要把-g写调宏定义CFLAGS = -g,但是还是不对.最后经过自己的摸索,才发现,如果
是.c的文件,用CFLAGS是可以的,但是如果是.cpp文件,则必须使用CPPFLAGS = -g才可以
贴上代码如下
CPP = g++ ##这里用gcc或者是g++都没有影响
CPPFLAGS = -g# -D_REENTRANT -DDEBUG -lpthread ##如果这里是cpp文件,一定用CPPFLAGS,如果是.c文件,一定用CFLAGS
OBJS = hello.o judge.o
PROG = hello
.PHONY : all clean
all:$(PROG)
$(PROG):$(OBJS)
$(CPP) $(CPPFLAGS) -o $(PROG) $(OBJS)
#也可以写成下面这样,这样就不用考试是用CFLAGS,或者是CPPFLAGS了,不过这样每次都会编译所有的文件,会消耗内在
#hello:hello.cpp judge.cpp
# gcc $(CFLAGS) -o hello hello.cpp judge.cpp
相关文章推荐
- 交叉调试时arm-linux-gdb提示:No symbol table is loaded. Use the "file" command.
- gdb调试错误:No symbol table is loaded. Use the "file&qu
- gdb调试中出现No symbol table is loaded. Use the "file" command.问题
- No symbol table is loaded. Use the "file" command.解决方法
- No symbol table is loaded. Use the "file" command
- No symbol table is loaded. Use the "file" command 解决方案
- eclipse+minGW 调试ffmpeg错误:No symbol table is loaded. Use the "file" command.
- No symbol table is loaded. Use the "file" command 解决方案
- Ubuntu 中Codelite出现No executable file specified. Use the "file" or "exec-file" command
- iOS "The sandbox is not in sync with the Podfile.lock"解决方式
- 使用QEmu调试Linux内核 “No symbol table is loaded.”
- xcode在真机调试的时候出现"The identity used to sign the executable is no longer valid"
- VC中The symbol is "xxx" undefined解决办法
- gdb调试时No symbol "var" defined in current context,局部变量不可查看问题
- How can I set the background of UITableView (the tableview style is "Grouped") to use an image?
- Ubuntu技巧之"xxx is not in the sudoers file"解决方法
- gdb调试时No symbol "var" defined in current context,局部变量不可查看问题
- the project file '' has been renamed or is no longer in the solution 解决办法
- gdb调试时No symbol "var" defined in current context && No Register
- gdb调试时No symbol "var" defined in current context,局部变量不可查看问题