Menu

#18 Compilation fails on clang due to use of internal GCC headers

v1.0 (example)
closed
nobody
None
5
2015-12-08
2013-12-01
No

When compiling using clang and the libc++ C++ standard library, htmlcxx fails to compile because it can't #include <bits char_traits.h="">.

This happens because of this conditional in ci_string.h:

#if __GNUC__ >= 3
#include <bits/char_traits.h>
struct ci_char_traits : public std::char_traits<char>
#elif defined(__GNUC__)
#include <std/straits.h>
struct ci_char_traits : public std::string_char_traits<char>
#else 
//Hope string already include it
struct ci_char_traits : public std::char_traits<char>
#endif

clang defines __GNUC__ for compatibility, however libc++ doesn't implement the same internal layout as GCC's libstdc++. The final case, relying on string to bring it in, works fine.

Note that bits/char_traits.h warns not to include it directly as it's an internal header:

/** @file char_traits.h
 *  This is an internal header file, included by other library headers.
 *  You should not attempt to use it directly.
 */

Discussion

  • Davi de Castro Reis

    Thanks a lot for the fix. I have incorporated in the git head (just took a couple years...).

     
  • Davi de Castro Reis

    • status: open --> closed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.