[cfe-dev] How do I try out C++ modules with clang?

Seth Cantrell seth.cantrell at gmail.com
Wed Oct 22 21:09:02 PDT 2014


I saw this error when I tried out -fmodules on OS X earlier as well, but it disappeared and I took it to be transient and due to something in my build of llvm/clang/libcxx. Now of course I'm seeing it again and I have no idea what allowed -fmodules to work for me before.

I tried Sean's suggestion of "moving `#include <__locale>` below `#include <cstdlib>`". To get things to build I had to put both of the following:

    #include <cstdlib>
    #include <xlocale/_stdlib.h>

before `#include <__locale>` in the `<locale>` header. Since `<xlocale/_stdlib.h>` is not in a module map (AFAICT, MacOSX10.10.sdk/usr/include/module.map does not mention the xlocale headers in the 10.10 SDK) I believe the included declarations become part of the `<locale>` module...

> On Oct 21, 2014, at 7:57 AM, Stephen Kelly <steveire at gmail.com> wrote:
> 
> /Users/ske/dev/prefix/bin/../include/c++/v1/locale:943:28: error: use of
> undeclared identifier 'strtold_l'
>        long double __ld = strtold_l(__a, &__p2, _LIBCPP_GET_C_LOCALE);
>                           ^
> test.cpp:6:10: fatal error: could not build module 'std'
> #include <utility>
> ~~~~~~~~^
> 
> 




More information about the cfe-dev mailing list