clang ++ C ++ 0x std :: locale

时间:2011-11-27 11:45:46

标签: c++ c++11 locale clang

我正在尝试构建以下应用程序;来自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 2.1版(标签/ Apple / clang-163.7.1)(基于LLVM 3.0svn)
  • 目标:x86_64-apple-darwin11.2.0
  • 主题模型:posix

1 个答案:

答案 0 :(得分:0)

此问题已在cppreference.com上解决。见上面的评论部分。

  

cppreference.com上的示例现已更新为使用该标准   消息::开放