stray ‘\200’ in program和error: stray ‘\343’ in program错误解决办法

http://blog.chinaunix.net/uid-21931325-id-2980964.html
error: stray ‘\200’ in program和error: stray ‘\343’ in program错误解决办法

分类: C/C++

2011-10-26 20:18:58

从网页复制了一段代码,用gcc编译的时候出现了一大堆错误,仔细看了下,发觉标点有问题,就把所有斜杠、逗号、引号、等号、括号都换成了西符,最后只剩下这些:

myApp.c:88: error: stray ‘\200’ in program
myApp.c:88: error: stray ‘\200’ in program
myApp.c:88: error: stray ‘\343’ in program
myApp.c:88: error: stray ‘\200’ in program
myApp.c:88: error: stray ‘\200’ in program
myApp.c:89: error: stray ‘\343’ in program
myApp.c:89: error: stray ‘\200’ in program
myApp.c:89: error: stray ‘\200’ in program
myApp.c:90: error: stray ‘\343’ in program

最后在这里找到了原因,是空格的半角和全角问题:
http://forum.ubuntu.org.cn/viewtopic.php?t=47870

在vi的命令模式下,全部替换,用法如下:
:g/p1/s//p2/g

令p1为全角空格,p2为半角空格即可,替换其他的符号是同样的用法。

你可能感兴趣的:(stray ‘\200’ in program和error: stray ‘\343’ in program错误解决办法)