文件系统和区域设置

Filesystem and locale

本文关键字:设置 区域 文件系统      更新时间:2023-10-16

我正在尝试构建使用NDK (android)的boost文件系统的代码。

一切正常,除了文件系统:

libs/filesystem/src/path.cpp:911: error: undefined reference to 'std::locale::locale(char const*)'
libs/filesystem/src/path.cpp:911: error: undefined reference to 'std::locale::locale(char const*)'
libs/filesystem/src/path.cpp:911: error: undefined reference to 'std::locale::locale(char const*)'
libs/filesystem/src/path.cpp:911: error: undefined reference to 'std::locale::locale(char const*)'

911行代码:

static std::locale posix_lazy_initialization(path::imbue(std::locale("")));

有什么办法解决这个问题吗?


当我将STL版本从:gnustl_static更改为gnustl_shared时,问题消失了。会是什么呢?

在906/907行,他们有MACRO

#if defined(BOOST_POSIX_API) && 
    !(defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__))

我将其更改为包含ANDROID

的例外
#if defined(BOOST_POSIX_API) && 
    !(defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) || defined(ANDROID))

到目前为止一切都很好,尽管我的代码不依赖于区域设置…

我已经把这个问题交叉贴到了安卓开发者谷歌组,所以也许他们会有一个明确的答案,为什么动态链接工作而不是静态。我会发布我得到的任何消息…