當試圖編譯鐺+的libC++(C++ 11模式)這一條線:升壓/ thread.hpp失敗 '鐺++ -std = C++ 11 -stdlib = libc的++'
#include <boost/thread.hpp>
鐺發出以下錯誤:
In file included from test.cpp:1: In file included from /Users/yongwei/Programming/boost_1_52_0/boost/thread.hpp:13: In file included from /Users/yongwei/Programming/boost_1_52_0/boost/thread/thread.hpp:17: In file included from /Users/yongwei/Programming/boost_1_52_0/boost/thread/pthread/thread_data.hpp:11: In file included from /Users/yongwei/Programming/boost_1_52_0/boost/thread/locks.hpp:18: In file included from /Users/yongwei/Programming/boost_1_52_0/boost/chrono/time_point.hpp:33: /Users/yongwei/Programming/boost_1_52_0/boost/chrono/duration.hpp:353:49: error: constexpr function never produces a constant expression static BOOST_CHRONO_LIB_CONSTEXPR float lowest() ... ^ /Users/yongwei/Programming/boost_1_52_0/boost/chrono/duration.hpp:355:21: note: non-constexpr function 'max' cannot be used in a constant expression return -(std::numeric_limits::max)(); ^ /usr/bin/../lib/c++/v1/limits:443:43: note: declared here _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return ... ^ In file included from test.cpp:1: In file included from /Users/yongwei/Programming/boost_1_52_0/boost/thread.hpp:13: In file included from /Users/yongwei/Programming/boost_1_52_0/boost/thread/thread.hpp:17: In file included from /Users/yongwei/Programming/boost_1_52_0/boost/thread/pthread/thread_data.hpp:11: In file included from /Users/yongwei/Programming/boost_1_52_0/boost/thread/locks.hpp:18: In file included from /Users/yongwei/Programming/boost_1_52_0/boost/chrono/time_point.hpp:33: /Users/yongwei/Programming/boost_1_52_0/boost/chrono/duration.hpp:361:50: error: constexpr function never produces a constant expression static BOOST_CHRONO_LIB_CONSTEXPR double lowest() ... ^ /Users/yongwei/Programming/boost_1_52_0/boost/chrono/duration.hpp:363:21: note: non-constexpr function 'max' cannot be used in a constant expression return -(std::numeric_limits::max)(); ^ /usr/bin/../lib/c++/v1/limits:443:43: note: declared here _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return ... ^ In file included from test.cpp:1: In file included from /Users/yongwei/Programming/boost_1_52_0/boost/thread.hpp:13: In file included from /Users/yongwei/Programming/boost_1_52_0/boost/thread/thread.hpp:17: In file included from /Users/yongwei/Programming/boost_1_52_0/boost/thread/pthread/thread_data.hpp:11: In file included from /Users/yongwei/Programming/boost_1_52_0/boost/thread/locks.hpp:18: In file included from /Users/yongwei/Programming/boost_1_52_0/boost/chrono/time_point.hpp:33: /Users/yongwei/Programming/boost_1_52_0/boost/chrono/duration.hpp:369:55: error: constexpr function never produces a constant expression static BOOST_CHRONO_LIB_CONSTEXPR long double lowest() ... ^ /Users/yongwei/Programming/boost_1_52_0/boost/chrono/duration.hpp:371:21: note: non-constexpr function 'max' cannot be used in a constant expression return -(std::numeric_limits::max)(); ^ /usr/bin/../lib/c++/v1/limits:443:43: note: declared here _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return ... ^ 3 errors generated.
在我看來,這是在libc中++中的錯誤,因爲C++ 11確實需要這些功能是constexpr
。
任何人都遇到同樣的問題,你能同意嗎?你知道任何修復嗎?
我鐺的版本是:
Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn) Target: x86_64-apple-darwin11.4.2 Thread model: posix
在這方面已修復了提示主幹libC++(http://libcxx.llvm.org)。 –
很高興知道。謝謝,霍華德。你知道蘋果什麼時候將解決方案發布到Xcode更新中嗎? –
對不起,我不知道。 –