未在此范围内声明原始字符串“R”
Raw String ‘R’ was not declared in this scope
我正在学习c++,所以请原谅我我正在尝试将原始字符串存储在C++但我得到‘R’ was not declared in this scope
这是我的代码
#include <iostream>
#include <string>
int main()
{
std::string nx =R"('(;<"/ )3-)";
std::cout << nx;
}
这是一个在线编译器,可以毫无问题地编译它
可能是我在 Ubuntu 15.10 和最新的 G++ 上的编译器 IM 的东西
原始字符串需要 C++11 或以上;如果在联机编译器中选择选项 C++98,则会收到与 g++ 相同的错误。请参阅以下命令以在 g++ 中启用 C++11(取自此 SO 答案,请在适用时投赞成票):
$ g++ -std=c++11 your_file.cpp -o your_program
相关文章:
- 有没有办法从非C/C++文件中读取C++原始字符串文字的内容
- 如何在连接器 C++ 中将原始字节转换为字符串
- 将以 null 结尾的字节字符串转换为原始字符串文本
- 是否可以在原始字符串文本中插入转义序列?
- 如何找到修改后的字符串与原始字符串相等的时间
- 如何在c++中打印原始std::string/c样式的字符串
- 是否存在像C++中那样带有分隔符的C#原始字符串
- 反转由空格分隔的字符串元素将返回比原始字符串更大的字符串
- C++ 原始字符串 Unicode 文字
- 编码大于原始文本:如何获取零和一的字符串并将它们作为实际字节写入文件
- 在对原始字符串进行一些处理后返回(或转换)原始字符串
- 打印可以重复以获取原始字符串的最小字符串
- 如何从字符串变量为正则表达式构建原始字符串
- 如何制作包含原始字符串终止符C++原始字符串
- 如何在 C++ VS 中使用原始字符串文字(编码问题)
- 如何将变量用作原始 JSON 字符串中的数据?
- 什么是原始字符串?
- 转义 R "()" 在 C++ 中的原始字符串中
- 原始字符串比普通字符串快
- C++多行字符串原始文字