clang++ C++0x std::locale
clang++ C++0x std::locale
我正在尝试构建以下应用程序;从http://en.cppreference.com/w/cpp/locale/messages.
#include <iostream>
#include <locale>
int main()
{
std::locale loc("de_DE");
auto& facet = std::use_facet<std::messages<char>>(loc);
auto cat = facet.open("libstdc++", loc, "/usr/share/locale");
std::cout << ""please" in German: "
<< facet.get(cat, 0, 0, "please") << 'n'
<< ""thank you" in German: "
<< facet.get(cat, 0, 0, "thank you") << 'n';
facet.close(cat);
}
main.cpp:134:45: error: too many arguments to function call, expected 2, have 3
auto cat = facet.open("libstdc++", loc, "/usr/share/locale");
~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/v1/locale:3528:5: note: 'open' declared here
_LIBCPP_ALWAYS_INLINE
^
/usr/include/c++/v1/__config:84:32: note: instantiated from:
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
^
1 error generated.
我已经删除了打开的第三个参数,一切正常。问题是我希望为我的文本域指定一个位置,而不是默认的。我已经查看了bindtextdomain,但未能在我的机器上识别。有提示吗?
环境:- Mac OSX Lion
- Apple clang version 2.1 (tags/Apple/clang-163.7.1)(基于LLVM 3.0svn)
- 目标:x86_64-apple-darwin11.2.0 线程模型:posix
此问题已在cppreference.com上解决。请看上面的评论部分。
cppreference.com上的示例现在已更新为使用该标准消息::打开
相关文章:
- 使用 std::locale 格式化法语数字时无效的 UTF-8 数据
- C++ std::locale( "en" ) 在 iOS 上引发异常
- 为什么 std::locale( " " ).name() 在 clang 和 gcc 上给出不同的结果?
- std::locale 向"en_US.UTF-8"区域设置抛出runtime_error异常
- 为什么当我将 std::locale 设置为 "zh_CN.UTF-8" 时 std::istringstream 失败?
- C++11:std::locale::empty() 甚至是一个东西
- std::locale 导致 Helgrind 出错
- STD :: LOCALE与LCONV :: P_CS_PRECEDES没有等效
- std::locale/std::facet关键部分
- std::locale::global是否影响printf()函数
- 我们是否应该释放为 std::locale 分配的资源
- VC6 - 如何使用用户定义的分面创建 std::locale
- "ctype" 抛<locale>出 std::bad_cast 的函数
- 打印所有 std::locale 名称 (Windows)
- 何时以及如何使用 std::locale::messages
- 覆盖 std::locale 上的多个分面
- std::locale::facet::_S_create_c_locale 名称无效
- 为什么 valgrind 为 libstdc++ 的 std::locale 报告错误?
- OS X上的std::locale段错误,不能在任何其他平台上重现
- clang++ C++0x std::locale