linux 下gcc编程汇总1(error: stray ‘Â’ in program)

在Linux环境下使用gcc编译C程序时,遇到'error: stray '302' in program'错误。这通常是由于文本编辑器意外插入了非ASCII字符导致的。解决方案包括删除含有问题字符的整行或移除多余的尾部字符。编程时必须确保使用半角标点符号,避免全角字符的误用。
摘要由CSDN通过智能技术生成

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)全角--指一个字符占用两个标准字符位置。 
汉字字符和规定了全角的英文字符及国标
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值