错误:stray'\XXX'在程序:为什么? [英] error: stray '\XXX' in program : Why?

查看:738
本文介绍了错误:stray'\XXX'在程序:为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C ++中写了一个小程序,遇到了一个奇怪的错误:

I'm writing a little program in C++, and come across a strange error :

src/Makefile/Tool.cpp:42:3: error: stray ‘\302’ in program
src/Makefile/Tool.cpp:42:3: error: stray ‘\240’ in program

我在vim中编写这个程序,相应的行(显示隐藏的字符)是:

I'm writing this program in vim and the corresponding line (showing hidden characters) is :

>--->---std::vector<std::string> { "--debug" }$ 

此问题不是这个错误,因为我只需要复制回行和错误原因消失。

This question is not about resolving this error, as I just have to copy back the line and the error-cause disappear.

似乎该错误是由一些字符引起的,甚至被vim隐藏后激活所有相关选项!

It seems that the error is caused by some characters even hidden by vim after activating all relative options!

问题是可能导致这些错误的原因。

The question is about what could have caused those errors.

推荐答案

\302\240是UTF-8用于 U + 00A0 NO- SPACE 。 Vim通常不会将它突出显示为任何特殊的,所以即使您已启用'list'模式,也可能潜行。

"\302\240" is UTF-8 for U+00A0 NO-BREAK SPACE. Vim won’t normally highlight it as anything special, so it’s possible for one to sneak in even if you have 'list' mode enabled.

您可以使用以下方式突出显示它们:

You can highlight them with:

:set listchars+=nbsp:.

或任何您喜欢的字元。

这篇关于错误:stray'\XXX'在程序:为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆