Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCC 4.9 - codecvt not found #24

Closed
lexicalunit opened this issue Oct 13, 2017 · 2 comments
Closed

GCC 4.9 - codecvt not found #24

lexicalunit opened this issue Oct 13, 2017 · 2 comments

Comments

@lexicalunit
Copy link
Contributor

From @kowalikm on August 27, 2015 13:55

Hello,

i have problem with compilation on Debian GCC 4.9:

fatal error: codecvt: Not found
#include <codecvt>
                   ^
compilation terminated.

AFAIK codecvt isn't supported by GCC yet.

Copied from original issue: lexicalunit/nanodbc#44

@lexicalunit
Copy link
Contributor Author

Support for codecvt is provided by the standard library rather than being strictly tied to a compiler implementation. By default, GCC will use libstdc++ as its standard library implementation. On OS X you can actually change that using the compiler flag -stdlib=libc++ as described on this stackoverflow page.

You indicated however that you're on Debian Linux so you don't have this luxury. You are also correct that, as of this writing, libstdc++ does not have full support for codecvt. Particularly, it is missing codecvt_utf8, which is the only thing nanodbc uses from that header. It may be possible to refactor the code to avoid use of this utility, for example using boost.

Note that the code path which makes use of codecvt is only entered in two cases:

  • When a wide string data column is fetched as a std::string.
  • With unicode support enabled for nanodbc, when a string data column is fetched as std::wstring.

If your code isn't doing either of these things, as a workaround you could replace the codecvt_utf8 calls with code to throw a runtime exception indicating that these operations are not currently supported on Linux.

@lexicalunit
Copy link
Contributor Author

I added an option to build nanodbc using Boost.Locale as the string convert implementation, rather than codecvt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant