【发布时间】:2016-03-18 13:23:37
【问题描述】:
当此行不在注释中时:
double random_seed, participation_fee, ticket_revenue;
编译器产生以下错误:
main.cpp:24:2: error: stray ‘\200’ in program
main.cpp:24:2: error: stray ‘\254’ in program
main.cpp:24:2: error: stray ‘\342’ in program
main.cpp:24:2: error: stray ‘\200’ in program
main.cpp:24:2: error: stray ‘\254’ in program
我已经尝试重新输入此行。我使用Sublime Text 作为文本编辑器。我该如何解决这个问题?
这是整个函数:
void starting_game(vector<int>&players, vector<Player*> player_obj)
{
int id, x, y, number=0;
char pos;
double random_seed,participation_fee,ticket_revenue;
string input;
cin >> number;
for(int i = 0; i < number; i++)
{
cin >> id;
cin.ignore(4,' ');
cin >> x;
cin.ignore(2,':');
cin >> y;
cin.ignore(2,':');
cin >> pos;
players.push_back(find_put(id, player_obj, x, y, pos));
}
//cin>>random_seed;//>>participation_fee>>ticket_revenue;
}
【问题讨论】:
-
这不是链接问题的副本。有问题的字符是不可见的(POP DIRECTIONAL FORMATTING、U+202c、
"\342\200\254"in UTF-8),这使得解决这个问题变得更加困难。 -
欢迎使用 StackOverflow。我已编辑您的帖子以使其更具可读性。为避免将来被否决,请在撰写帖子时更加小心。良好的语言通常有助于人们认真对待并回答您的问题。
-
将整个内容复制并粘贴到纯文本编辑器中,然后返回。
-
此是常见问题解答。真正的典型问题是 Compilation error: stray ‘\302’ in program, etc。这种类型的所有问题都可以用完全相同的方式分析:数字序列(通常)是八进制的。将它们转换为十六进制并搜索 UTF-8 序列以找到 Unicode code point。它可以通过在能够使用正则表达式搜索的文本编辑器中使用正则表达式搜索(使用
\x{Unicodepoint})直接搜索(和替换)。
标签: c++