boost :: filesystem :: path(std :: wstring)抛出异常 [英] boost::filesystem::path(std::wstring) throw exception

查看:149
本文介绍了boost :: filesystem :: path(std :: wstring)抛出异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此代码:

boost::filesystem::is_directory("/usr/include");

做得好.

这两个代码:

boost::filesystem::is_directory(L"/usr/include");

引发异常:

终止在抛出一个'std :: runtime_error'
的实例什么():语言环境::方面:: _ S_create_c_语言环境名称无效

terminate called after throwing an instance of 'std::runtime_error'
what(): locale::facet::_S_create_c_locale name not valid

OS-Linux Mint

OS - Linux Mint

提升1.43

gcc-4.6.0

gcc-4.6.0

推荐答案

  1. 在Linux上不要使用宽字符串.您不需要它们.
  2. 它尝试将宽字符串转换为普通字符串会发生什么情况,为此创建一个语言环境,并且该语言环境可能未在您的系统中配置.

  1. Don't use wide strings on Linux. You don't need them..
  2. What happens that it tries to convert wide string to normal one and for this creates a locale and probably this locale is not configured in your system.

输出命令:

locale 
locale -a

  • GCC-4.6尚未发布;-),请检查这是否适用于普通编译器.libstdc ++可能无法很好地构建.
  • GCC-4.6 wasn't released yet ;-), check if this works with ordinary compiler. Probably libstdc++ wasn't build well.
  • 这篇关于boost :: filesystem :: path(std :: wstring)抛出异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆