libstdc++ 无法识别标准库文本
libstdc++ doesn't recognise standard library literals
我正在尝试编译一个简单的程序,使用std::literals
名称空间的字面量,但是当我试图编译它时Clang正在生成错误。
我要编译的代码:
#include <string>
#include <iostream>
using namespace std::literals;
int main()
{
std::cout << "Hello World!"s << std::endl;
return 0;
}
和编译命令:
clang++ -stdlib=libstdc++ -std=c++1y a.cpp
导致如下输出:
a.cpp:4:22: error: expected namespace name
using namespace std::literals;
~~~~~^
a.cpp:8:29: error: no matching literal operator for call to 'operator "" s' with arguments of
types 'const char *' and 'unsigned long', and no matching literal operator template
std::cout << "Hello World!"s << std::endl;
^
2 errors generated.
由于各种原因,使用g++或libc++是不可能的,并且我已经确认了其他c++ 14特性(例如:返回类型演绎和二进制文字)工作,所以它不是编译器的问题,让我相信它涉及libstdc++。
我能做些什么来解决这个问题?我用的是Linux Mint 17.1,如果有区别的话
记住要确保按照c++ 14编译源代码(c++ 11中没有提供计时文字)。
clang++ -stdlib=libstdc++ -std=c++14 a.cpp
相关文章:
- 文本文件中的单词链表
- 从命令行c++发送文本文件名
- 在C++程序中输入的文本文件将不起作用,除非文本被复制和粘贴
- 2D数组来自文本输入,中间有空格
- 如何将内容数组写入文本文件?
- 使用CMake检测支持的C++标准
- 标准是否阻止在可变参数模板中使用足够小的文本值缩小文本转换范围
- 在哪里定义了预定义'user-defined'文本"m"的标准库?
- 查找字符在标准输入文本中出现的次数
- 使用标准C++无线流读取UTF-8文本并转换为UTF-16
- 在 c/c++ 中编辑从 stdin 打印在标准输出上的文本
- Qt类型的标准文本表示是什么?
- 从文本文件加载标准::映射
- C++ - 在文本文件中查找和替换(标准系统库)
- C++标准是否保证字符串文本完全存储在程序中 二进制文件.
- 为什么默认情况下全局命名空间中没有 C++14 个标准定义的文本?
- 对于 C++11,我是否仍然需要一个用于 Unicode 文本的非标准字符串操作库
- 将文本文件传递给标准输入
- libstdc++ 无法识别标准库文本
- 将字符串变量的值与一些文本链接,并将其打印到C++中的标准输出