S
S
sddvxd2018-06-26 00:50:40
C++ / C#
sddvxd, 2018-06-26 00:50:40

Why does the "empty is not a member of std::locale" error occur?

Hello

std::wifstream wif("C:\\cpp\\permission.txt", std::ios::binary);
    if (wif.is_open())
    {
      static std::locale empty ();
          wif.imbue(std::locale(std::locale::empty(), new std::codecvt_utf8<wchar_t,0x10ffff, std::consume_header>));

        std::wstring wline;
        while (std::getline(wif, wline))
        {
            LPCWSTR wline = wline;
            MessageBoxW(FindWindowW(NULL, L"Корзина"), NULL, wline, MB_YESNO);
        }

        wif.close();
    }

The compiler throws an error "empty is not a member of std::locale"
All necessary header files are included

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2018-06-26
@sddvxd

std::locale::empty()
Compiler gives error "empty is not a member of std::locale"
empty is indeed not a member of std::locale. I suspect that you meant to write
or
static std::locale empty;
wif.imbue(std::locale(empty, new std::codecvt_utf8<wchar_t,0x10ffff, std::consume_header>));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question