QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1454|回复: 1

gdb调试出问题

[复制链接]
发表于 2006-3-3 15:00:53 | 显示全部楼层 |阅读模式
我在调试iii.c错误时始终都 不对,请各位指点一下。小妹在此谢过了。
///*以下为iii.c程序*///
#include<stdio.h>
#include<stdlib.h>
#define BIGNUM 5000

void  index_to_the_moon(int ary[]);
void main(void)
{int intray[100];
index_to_the_moon(int ary[]);
exit(EXIT_SUCCESS);
}
void  index_to_the_moon(int ary[])
{int i;
for(i=0;i<BIGNUM;++i)
            ary=i;
}
编译过程如下:
[sunny@GQ ~]$ gcc -ggdb3 -o cs  iii.c
iii.c: In function 'main':
iii.c:8: error: syntax error before 'int'
iii.c:7: warning: return type of 'main' is not 'int'
iii.c:16:2: warning: no newline at end of file
[sunny@GQ ~]$ gdb iii core
GNU gdb 6.3-5mdk (Mandriva Linux release 2006.0)
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 "i586-mandriva-linux-gnu"...iii: 没有那个文件或目录.

/home/sunny/core: 没有那个文件或目录.
(gdb)                                     [sunny@GQ ~]$ gcc -ggdb3 -o cs  iii.c
iii.c: In function 'main':
iii.c:8: error: syntax error before 'int'
iii.c:7: warning: return type of 'main' is not 'int'
iii.c:16:2: warning: no newline at end of file
[sunny@GQ ~]$ gdb iii core
GNU gdb 6.3-5mdk (Mandriva Linux release 2006.0)
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 "i586-mandriva-linux-gnu"...iii: 没有那个文件或目录.

/home/sunny/core: 没有那个文件或目录.
(gdb) break main
No symbol table is loaded.  Use the "file" command.
(gdb) break 15
No symbol table is loaded.  Use the "file" command.
(gdb)      

显示的总是不对,我是哪里写错了。大家快点拔一下
发表于 2006-3-3 15:25:46 | 显示全部楼层
index_to_the_moon(int ary[]);  -->  index_to_the_moon(ary);

> gdb cs
> break main
回复

使用道具 举报

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

本版积分规则

GMT+8, 2024-11-2 22:42 , Processed in 0.064816 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

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