3

I can't even get the basic codecvt example from cppreference.com to compile on GCC 4.9 or Clang 3.4, e.g.:

http://goo.gl/HZ5GLH

http://coliru.stacked-crooked.com/a/345d6d89949ac1e6

Chris_F
  • 4,991
  • 5
  • 33
  • 63
  • I think the current trunk libc++ supports codecvt properly... – Kerrek SB Jun 30 '14 at 19:57
  • Are you telling your compiler to use C++11? – Cogwheel Jun 30 '14 at 20:05
  • Rather than being an issue of compiler version, this is down to the implementation of the standard library. libc++ has supported codecvt for a long time. For clang the flag to switch to libc++ is `-stdlib=libc++`: http://rextester.com/EPRYNU17491 – bames53 Jun 30 '14 at 20:06
  • And the site coliru.stacked-crooked.com does not have libc++ installed, so you can't try it there. – bames53 Jun 30 '14 at 20:06
  • @barnes53 coliru does have libc++ installed http://coliru.stacked-crooked.com/a/e1b8ab4ea3b8e161 (OP still has to fix the erroneous cast to unsigned char, but the command line is shown) – Cubbi Jun 30 '14 at 20:41
  • @Cubbi Oh, neat. That's new since the last time I tried. – bames53 Jun 30 '14 at 21:06
  • @Cubbi Oh, I see the issue I had before was the -lsupc++ flag – bames53 Jul 01 '14 at 21:41

1 Answers1

3

According to libstdc++ manual, part 22.4.1, it is missing the support for codecvt, even on the latest version.

And libc++ has complete support for C++11 and C++14 features, so you should use it on CLang, specifying the -stdlib=libc++ compiler flag (make sure you have it installed).

Edit: As of current versions of libstdc++, codecvt is now supported.

Bruno Ferreira
  • 1,621
  • 12
  • 19
  • Adding this flag solved many mysterious "Implicit instantiation of undefined template std::__1::codecvt" errors I was getting on a project that built on Linux (w/ GCC) and Windows (w/ MSVC) but not on OS X (w/ Clang). – UltraNurd Aug 13 '14 at 21:57