LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1076|回复: 2

gcc编译时可以不设置连接动态共享库吗,我在gdb里老是报错

[复制链接]
发表于 2005-4-7 22:48:05 | 显示全部楼层 |阅读模式
[root@localhost main]# gcc -g -o print print.c
[root@localhost main]# gdb print
GNU gdb Red Hat Linux (6.0post-0.20040223.19rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host libthread_db library "/lib/tls/libthread_db.so.1".

(gdb) list
1       #include <stdio.h>
2       main()
3       {
4         int i;
5         printf("hello world");
6       }
(gdb) run
Starting program: /root/main/print
Error while mapping shared library sections:
: 成功.
Error while reading shared library symbols:
: 没有那个文件或目录.
Error while reading shared library symbols:
: 没有那个文件或目录.
Error while reading shared library symbols:
: 没有那个文件或目录.
hello world
Program exited with code 013.
(gdb) auto-solib-add 0
Undefined command: "auto-solib-add".  Try "help".
(gdb)
发表于 2005-4-8 10:07:02 | 显示全部楼层
这个问题与gcc无关。应用程序一般都是要链接到动态库的,不想链接到动态库可以静态编译。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-4-8 22:38:13 | 显示全部楼层
我用静态编译了gcc -static -g -o print print.c

gdb里调试不报错了,嘿嘿,谢谢版主了,以后还要多向你请教呀
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表