linux下C语言错误整理
2015-06-27 22:59
543 查看
1.error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
error: expected '{' at end of input
这里就是的错误就是写代码不细心造成的,可能是声明函数时,没有加“;”号,也有可能是include<stdio.h>前面没有加“#”号,或是将其它一些符号写错。
2.error: 'for' loop initial declarations are only allowed in C99 mode
原因是在循环条件中声明变量的话,只在C99标准中支持,C90标准不支持。
例: for (int i = 0; i < n; i++)
改为 int i; for(i=0;i<n;i++)
3.In function 'mian':
error: stray '\' in program
error: expected ')' before 'n'
main写成mian了吧
4.error: conio.h: No such file or directory
将#include <conio.h> 改为#include <curses.h>
5.warning: 'struct sqlist' declared inside parameter list
例:void win(struct sqlist *l);
void insert(struct sqlist *l,int i,int e);
struct sqlist{
int *elem;
int length;
int listsize;
};
改为这样就不会出现警告了(函数声明要在结构体后面):
struct sqlist{
int *elem;
int length;
int listsize;
};
void win(struct sqlist *l);
void insert(struct sqlist *l,int i,int e);
6.error: 'OVERFLOW' undeclared (first use in this function)
exit(OVERFLOW) 改为:exit(0) 就OK了!
7.warning:assignment from incompatible pointer type
这说明在赋值的时候,赋值符左右两边指针类型不相同。
例: int *int_p;
double double_variable;
/*将指向double变量的指针赋值指向int的指针变量(这时就会出现上面的警告)*/
int_p = &double_variable;
8.error:(.text+0x7): undefined reference to `function_a'
这说明function_a函数只声明和调用了,忘了定义吧,赶紧定义一下!
error: expected '{' at end of input
这里就是的错误就是写代码不细心造成的,可能是声明函数时,没有加“;”号,也有可能是include<stdio.h>前面没有加“#”号,或是将其它一些符号写错。
2.error: 'for' loop initial declarations are only allowed in C99 mode
原因是在循环条件中声明变量的话,只在C99标准中支持,C90标准不支持。
例: for (int i = 0; i < n; i++)
改为 int i; for(i=0;i<n;i++)
3.In function 'mian':
error: stray '\' in program
error: expected ')' before 'n'
main写成mian了吧
4.error: conio.h: No such file or directory
将#include <conio.h> 改为#include <curses.h>
5.warning: 'struct sqlist' declared inside parameter list
例:void win(struct sqlist *l);
void insert(struct sqlist *l,int i,int e);
struct sqlist{
int *elem;
int length;
int listsize;
};
改为这样就不会出现警告了(函数声明要在结构体后面):
struct sqlist{
int *elem;
int length;
int listsize;
};
void win(struct sqlist *l);
void insert(struct sqlist *l,int i,int e);
6.error: 'OVERFLOW' undeclared (first use in this function)
exit(OVERFLOW) 改为:exit(0) 就OK了!
7.warning:assignment from incompatible pointer type
这说明在赋值的时候,赋值符左右两边指针类型不相同。
例: int *int_p;
double double_variable;
/*将指向double变量的指针赋值指向int的指针变量(这时就会出现上面的警告)*/
int_p = &double_variable;
8.error:(.text+0x7): undefined reference to `function_a'
这说明function_a函数只声明和调用了,忘了定义吧,赶紧定义一下!
相关文章推荐
- Linux入门篇之六:辅助工具的使用
- Linux下NFS详解
- CentOS7安装iptables防火墙
- Centos6.6 安装基于系统认证的vsftp服务
- Linux下Mysql常见连接错误
- Linux Shell脚本之自动修改IP
- linux vi编辑常用命令
- Linux远程连接putty出现Network Erroe: Software caused connection abort
- linux命令
- linux 环境变量设置方法总结(PATH/LD_LIBRARY_PATH)
- 虚拟机Linux----Ubuntu1204----安装jdk1.8
- linux常用命令的英文单词缩写
- Linux图形界面与字符界面切换
- [Linux]在终端启动程序关闭终端不退出的方法
- linux下一个eclipse组态jdk
- linux程序设计——make命令和makefile文件(第九章)
- Linux 下终端 C 语言控制光标的技巧
- CentOS7 (64位) 下QT5.5 连接MySQL数据库(driver not loaded)
- 虚拟机Linux----Ubuntu1204----设置固定Ip
- Linux1.0内核中断体系的建立