无法找到数字文字运营商的运营商‘’

无法找到数字文字运营商的运营商‘’

问题描述:

我试图创建一个数组里面:因为我有我的工作/ O文件1_0R 1_5R 2_0R无法找到数字文字运营商的运营商‘’

char height[] = { 1_0R , 1_5R , 2_0R }; 

,并提到该字符串是内部的文件名。我用 +to_string(height[1])+

我编译时得到3个错误

**error: unable to find numeric literal operator ‘operator""_0R’** 
**error: unable to find numeric literal operator ‘operator""_5R’** 
**error: unable to find numeric literal operator ‘operator""_0R’** 

我能做些什么?

+0

你的意思'字符*高度[] = { “1_0R”, “1_5R”, “2_0R”}'? –

+0

当他说“数字文字”时,我认为他的意思是R的“用户定义文字”,如http://en.cppreference.com/w/cpp/language/user_literal –

您不能在开头使用数字命名变量。

这些变量不被C++命名变量标准接受。

我想你指的是以下

char *height[] = {"1_0R","1_5R","2_0R"}