boost::filesystem::path(std::wstring) throw exception

最后都变了- 提交于 2021-01-27 20:34:31

问题


this code:

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

work fine.

both this code:

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

throw an exception:

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

OS - Linux Mint

boost-1.43

gcc-4.6.0


回答1:


  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.

    Bring output of commands:

    locale 
    locale -a
    
  3. GCC-4.6 wasn't released yet ;-), check if this works with ordinary compiler. Probably libstdc++ wasn't build well.


来源:https://stackoverflow.com/questions/2928409/boostfilesystempathstdwstring-throw-exception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!