Compile error using boost 1.53.0, clang, libstdc++ and C++11
Hi, at the moment I try to compile a project that is using boost on my mac. The project is using c++11 features so I need to use clang with libstdc++. I compiled boost with: |./b2 toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" | It seems that trying to include "boost/date_time/gregorian/gregorian.hpp" leads to the compile error below. Googling I found some remarks about char16_t and char32_t types new in C++-11. Is that compiler/library combination in boost not supported yet? Has anyone successfully got that combination to work? Best Regards, Roman Himmes In file included from basic_log_setup.cpp:1: In file included from ./basic_log_setup.hpp:6: In file included from ../../../cryptotec/cryptotec/base/basic_types.hpp:5: In file included from /Users/username/Development/3rdParty/boost_1_53_0/boost/date_time/gregorian/gregorian.hpp:20: In file included from /Users/username/Development/3rdParty/boost_1_53_0/boost/date_time/gregorian/gregorian_types.hpp:25: In file included from /Users/username/Development/3rdParty/boost_1_53_0/boost/date_time/date_generators.hpp:17: In file included from /usr/bin/../lib/c++/v1/sstream:175: /usr/bin/../lib/c++/v1/istream:278:26: error: implicit instantiation of undefined template 'std::__1::ctype<unsigned int>' if (!__ct.is(__ct.space, *__i)) ^ /usr/bin/../lib/c++/v1/istream:1593:57: note: in instantiation of member function 'std::__1::basic_istream<unsigned int, std::__1::char_traits<unsigned int> >::sentry::sentry' requested here typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true); ^ basic_log_setup.cpp:107:2: note: in instantiation of function template specialization 'std::__1::getline<unsigned int, std::__1::char_traits<unsigned int>, std::__1::allocator<unsigned int> >' requested here std::getline(in, out1.codepoints(), separator); ^ /usr/bin/../lib/c++/v1/__locale:388:47: note: template is declared here template <class _CharT> class _LIBCPP_VISIBLE ctype; ^ /usr/bin/../lib/c++/v1/__locale:171:54: error: implicit instantiation of undefined template 'std::__1::ctype<unsigned int>' return static_cast<const _Facet&>(*__l.use_facet(_Facet::id)); ^ /usr/bin/../lib/c++/v1/istream:274:41: note: in instantiation of function template specialization 'std::__1::use_facet<std::__1::ctype<unsigned int> >' requested here const ctype<_CharT>& __ct = use_facet<ctype<_CharT>
(__is.getloc()); ^ /usr/bin/../lib/c++/v1/istream:1593:57: note: in instantiation of member function 'std::__1::basic_istream<unsigned int, std::__1::char_traits<unsigned int> >::sentry::sentry' requested here typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true); ^ basic_log_setup.cpp:107:2: note: in instantiation of function template specialization 'std::__1::getline<unsigned int, std::__1::char_traits<unsigned int>, std::__1::allocator<unsigned int> >' requested here std::getline(in, out1.codepoints(), separator); ^ /usr/bin/../lib/c++/v1/__locale:388:47: note: template is declared here template <class _CharT> class _LIBCPP_VISIBLE ctype; ^ In file included from basic_log_setup.cpp:1:
Hey, I think you need to make sure that clang is running with the '-std=c++11' option, or that is added to your cxxflags somehow. I don't know if there is a better way now, but to build with clang/libc++/C++11 on OS X I add the following to tools/build/v2/user-config.jam: using clang : osx : xcrun clang -arch i386 -arch x86_64 -stdlib=libc++ -std=c++11 -fvisibility-inlines-hidden ; and then run: ./b2 toolset=clang-osx On Sat, May 11, 2013 at 6:51 AM, Roman Himmes <himmes@idev.de> wrote:
Hi,
at the moment I try to compile a project that is using boost on my mac. The project is using c++11 features so I need to use clang with libstdc++. I compiled boost with:
./b2 toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++"
It seems that trying to include "boost/date_time/gregorian/gregorian.hpp" leads to the compile error below. Googling I found some remarks about char16_t and char32_t types new in C++-11. Is that compiler/library combination in boost not supported yet? Has anyone successfully got that combination to work?
Best Regards,
Roman Himmes
In file included from basic_log_setup.cpp:1: In file included from ./basic_log_setup.hpp:6: In file included from ../../../cryptotec/cryptotec/base/basic_types.hpp:5: In file included from /Users/username/Development/3rdParty/boost_1_53_0/boost/date_time/gregorian/gregorian.hpp:20: In file included from /Users/username/Development/3rdParty/boost_1_53_0/boost/date_time/gregorian/gregorian_types.hpp:25: In file included from /Users/username/Development/3rdParty/boost_1_53_0/boost/date_time/date_generators.hpp:17: In file included from /usr/bin/../lib/c++/v1/sstream:175: /usr/bin/../lib/c++/v1/istream:278:26: error: implicit instantiation of undefined template 'std::__1::ctype<unsigned int>' if (!__ct.is(__ct.space, *__i)) ^ /usr/bin/../lib/c++/v1/istream:1593:57: note: in instantiation of member function 'std::__1::basic_istream<unsigned int, std::__1::char_traits<unsigned int> >::sentry::sentry' requested here typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true); ^ basic_log_setup.cpp:107:2: note: in instantiation of function template specialization 'std::__1::getline<unsigned int, std::__1::char_traits<unsigned int>, std::__1::allocator<unsigned int> >' requested here std::getline(in, out1.codepoints(), separator); ^ /usr/bin/../lib/c++/v1/__locale:388:47: note: template is declared here template <class _CharT> class _LIBCPP_VISIBLE ctype; ^ /usr/bin/../lib/c++/v1/__locale:171:54: error: implicit instantiation of undefined template 'std::__1::ctype<unsigned int>' return static_cast<const _Facet&>(*__l.use_facet(_Facet::id)); ^ /usr/bin/../lib/c++/v1/istream:274:41: note: in instantiation of function template specialization 'std::__1::use_facet<std::__1::ctype<unsigned int>
' requested here const ctype<_CharT>& __ct = use_facet<ctype<_CharT> (__is.getloc()); ^ /usr/bin/../lib/c++/v1/istream:1593:57: note: in instantiation of member function 'std::__1::basic_istream<unsigned int, std::__1::char_traits<unsigned int> >::sentry::sentry' requested here typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true); ^ basic_log_setup.cpp:107:2: note: in instantiation of function template specialization 'std::__1::getline<unsigned int, std::__1::char_traits<unsigned int>, std::__1::allocator<unsigned int> >' requested here std::getline(in, out1.codepoints(), separator); ^ /usr/bin/../lib/c++/v1/__locale:388:47: note: template is declared here template <class _CharT> class _LIBCPP_VISIBLE ctype; ^ In file included from basic_log_setup.cpp:1:
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Rich E
-
Roman Himmes