linux 下gcc编程错误(error: stray ‘Â’ in program) 解决方法
2012-04-09 14:39
567 查看
error: stray ‘\302’ in program
For those who have already encountered this error “error: stray ‘\302’ in program” or something similar while compiling a program in C :
fool@localhost:~$ gcc -o hello_world hello_world.c
hello_world.c: In function ‘main’ :
hello_world.c:5: error: stray ‘\302’ in program
hello_world.c:5: error: stray ‘\304’ in program
Either you have to remove the entire line (here line 5), or you just have to remove some trailing characters. Sometimes, while writing into a text editor, some non-ASCII characters are inserted accidentally.
主要产生的原因就是全角字符和半角字符在编程时候的使用错误。注意:
编程的时候标点符号只能使用半角的,不能使用全角的。注意.以下是网上找的一片文章:
看看吧。
A 什么是全角和半角?
(1)全角--指一个字符占用两个标准字符位置。 汉字字符和规定了全角的英文字符及国标GB2312-80中的图形符号和特殊字符都是全角字符。一般的系统命令是不用全角字符的,只是在作文字处理时才会使用全角字符。
(2)半角--指一字符占用一个标准的字符位置。通常的英文字母、数字键、符号键都是半角的,半角的显示内码都是一个字节。在系统内部,以上三种字符是作为基本代码处理的,所以用户输入命令和参数时一般都使用半角。
B 全角与半角各在什么情况下使用?
全角占两个字节,半角占一个字节。半角全角主要是针对标点符号来说的,全角标点占两个字节,半角占一个字节,而不管是半角还是全角,汉字都还是要占两个字节。在编程序的源代码中只能使用半角标点(不包括字符串内部的数据)在不支持汉字等语言的计算机上只能使用半角标点(其实这种情况根本就不存在半角全角的概念)对于大多数字体来说,全角看起来比半角大,当然这不是本质区别了。
C 全角和半角的区别全角就是字母和数字等与汉字占等宽位置的字。
半角就是ASCII方式的字符,在没有汉字输入法起做用的时候输入的字母数字和字符都是半角的。在汉字输入法出现的时候,输入的字母数字默认为半角,但是标点则是默认为全角,可以通过鼠标点击输入法工具条上的相应按钮来改变。
D 关于“全角”和“半角”:
全角:是指中GB2312-80(《信息交换用汉字编码字符集·基本集》)中的各种符号。
半角:是指英文件ASCII码中的各种符号。
For those who have already encountered this error “error: stray ‘\302’ in program” or something similar while compiling a program in C :
fool@localhost:~$ gcc -o hello_world hello_world.c
hello_world.c: In function ‘main’ :
hello_world.c:5: error: stray ‘\302’ in program
hello_world.c:5: error: stray ‘\304’ in program
Either you have to remove the entire line (here line 5), or you just have to remove some trailing characters. Sometimes, while writing into a text editor, some non-ASCII characters are inserted accidentally.
主要产生的原因就是全角字符和半角字符在编程时候的使用错误。注意:
编程的时候标点符号只能使用半角的,不能使用全角的。注意.以下是网上找的一片文章:
看看吧。
A 什么是全角和半角?
(1)全角--指一个字符占用两个标准字符位置。 汉字字符和规定了全角的英文字符及国标GB2312-80中的图形符号和特殊字符都是全角字符。一般的系统命令是不用全角字符的,只是在作文字处理时才会使用全角字符。
(2)半角--指一字符占用一个标准的字符位置。通常的英文字母、数字键、符号键都是半角的,半角的显示内码都是一个字节。在系统内部,以上三种字符是作为基本代码处理的,所以用户输入命令和参数时一般都使用半角。
B 全角与半角各在什么情况下使用?
全角占两个字节,半角占一个字节。半角全角主要是针对标点符号来说的,全角标点占两个字节,半角占一个字节,而不管是半角还是全角,汉字都还是要占两个字节。在编程序的源代码中只能使用半角标点(不包括字符串内部的数据)在不支持汉字等语言的计算机上只能使用半角标点(其实这种情况根本就不存在半角全角的概念)对于大多数字体来说,全角看起来比半角大,当然这不是本质区别了。
C 全角和半角的区别全角就是字母和数字等与汉字占等宽位置的字。
半角就是ASCII方式的字符,在没有汉字输入法起做用的时候输入的字母数字和字符都是半角的。在汉字输入法出现的时候,输入的字母数字默认为半角,但是标点则是默认为全角,可以通过鼠标点击输入法工具条上的相应按钮来改变。
D 关于“全角”和“半角”:
全角:是指中GB2312-80(《信息交换用汉字编码字符集·基本集》)中的各种符号。
半角:是指英文件ASCII码中的各种符号。
相关文章推荐
- linux 下gcc编程汇总1(error: stray ‘Â’ in program)
- Eclipse+CDT+MinGW出错:Error: Cannot run program "gcc": ????????解决方法
- Linux 套接字编程中 bind 错误:bind fail:Address already in use 解决方法
- Linux 套接字编程中 bind 错误:bind fail:Address already in use 解决方法
- error: stray ‘\302’ in program/error: stray ‘\240’ in program解决方法
- 安装lxml时gcc: internal compiler error: Killed (program cc1)的解决方法
- linux下安装pygame错误:linux/videodev.h:No such file or directory error解决方法
- [php错误]PHP中Notice: unserialize(): Error at offset of bytes in on line 的解决方法
- mx:states包含mx:AddChild 在切换时提示错误"TypeError: Error #1009: 无法访问空对象引用的属性或方法"的解决方法
- Linux下报“error while loading shared libraries: libncurses.so.4...”错误的解决方法
- Linux系统:an error occurred during the file system check 错误解决方法
- 解决SQL Server 2005 还原数据库错误:System.Data.SqlClient.SqlError: 在对 'C:/Program Files/Microsoft SQL Server/MSSQL.1/MSSQL/BusinessDB.mdf
- Linux初次登陆、重置MySQL密码步骤,以及错误Unknown column 'password' in 'field list'的解决方法
- python 处理中文时出现的错误'ascii' codec can't decode byte 0xe9 in position 0: ordinal not in range(128)" 解决方法
- [解决问题][不能更新eclipse]错误提示:Error retrieving "feature.xml". [error in opening zip file]
- error: stray ‘\200’ in program解决
- 【Linux学习】Linux报“xxx is not in the sudoers file.This incident will be reported” 错误解决方法
- 联想Linux系统转XP出现error 17错误的解决方法
- 在VMware上编译linux内核出现VFS: Cannot open root device "LABEL=/" or unknown-block(0,0) 错误的解决方法
- 关于Error 1 error C1189: #error : "include 'stdafx.h' before including this file这个错误的解决方法