1):Program terminated with signal 6, Aborted.
栈溢出问题报错
No symbol table is loaded. Use the "file" command.
Aborted (core dumped)
(gdb) where
#0 0x0000003aaa232925 in ?? ()
#1 0x0000003aaa234105 in ?? ()
#2 0x00007fff7b621418 in ?? ()
#3 0x00007fff7b621400 in ?? ()
#4 0x00007fff7b622875 in ?? ()
#5 0x000000000000000b in ?? ()
#6 0x0000003aaa3578cf in ?? ()
#7 0x0000000000000003 in ?? ()
#8 0x00007fff7b62140a in ?? ()
#9 0x0000000000000006 in ?? ()
#10 0x0000003aaa3578d3 in ?? ()
#11 0x0000000000000002 in ?? ()
#12 0x00007fff7b6213fe in ?? ()
#13 0x0000000000000002 in ?? ()
#14 0x0000003aaa355e84 in ?? ()
#15 0x0000000000000001 in ?? ()
#16 0x0000003aaa3578cf in ?? ()
#17 0x0000000000000003 in ?? ()
#18 0x00007fff7b621406 in ?? ()
#19 0x000000000000000a in ?? ()
---Type <return> to continue, or q <return> to quit---
2)头文件未加#,产生错误如下
heap.c:3: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before string constant
heap.c:10: error: expected ‘)’ before ‘a’
heap.c:15: error: expected ‘)’ before ‘*’ token
heap.c:30: error: expected identifier or ‘(’ before ‘if’
make: *** [heap] Error 1
3)警告:赋值从指针中生成整数。
源代码
void Swap(HeapType* a,HeapType* b)
{
HeapType *tmp=a;//错误行
*a=*b;
*b=tmp;
return;
}
heap.c:47: warning: assignment makes integer from pointer without a cast
4)error: two or more data types in declaration specifiers
error:two or more data types in declaration specifiers
原因可能有两个:
- 少了一个分号”;”,比如定义一个结构体时,在最后忘了加分号。
解决方法:加上分号即可。
- 重复定义,比如:a.h文件中有如下定义:
error: <strong>two or more data types in declaration specifiers</strong>
error:two or more data types in declaration specifiers
原因可能有两个:
1. 少了一个分号";",比如定义一个结构体时,在最后忘了加分号。
解决方法:加上分号即可。
2. 重复定义,比如:a.h文件中有如下定义:
error: <strong>two or more data types in declaration specifiers</strong>
error:two or more data types in declaration specifiers
原因可能有两个:
1. 少了一个分号";",比如定义一个结构体时,在最后忘了加分号。
解决方法:加上分号即可。
2. 重复定义,比如:a.h文件中有如下定义:
#define bool char
#define bool char
b.h文件中有如下定义:
typedefcharbool;
typedef char bool;
然后在main.c中同时包含a.h和b.h:
#include "a.h"
#include "b.h"
5)
server.c:113: error: expected ‘)’ before ‘;’ token
server.c:113: error: too few arguments to function ‘select’
问题出现的地方:(函数中把,写成了;)
int ret=select(max_fd+1 ; &read_fds,NULL,NULL,NULL)
改正后
int ret=select(max_fd+1,&read_fds,NULL,NULL,NULL)