gpt4 book ai didi

c++ - boost bind.hpp 1.54 c++ 专用模板无法在 Solaris 上编译。有效的 C++?

转载 作者:太空宇宙 更新时间:2023-11-04 11:47:42 27 4
gpt4 key购买 nike

使用 Sun Studio 编译器为 Solaris 10 SPARC 编译 Phusion Passenger 时,这些错误会出现在包含的 boost 1.54 header 中。如何重写它们以解决编译错误?

"ext/boost/bind/bind.hpp", line 69: Error: boost::_bi::F is not a namespace or class name.
"ext/boost/bind/bind_template.hpp", line 15: Where: While specializing
"boost::_bi::result_traits<boost::_bi::unspecified, extern "C" int(*)(DIR*)>".
"ext/boost/bind/bind_template.hpp", line 15: Where: Specialized in
boost::_bi::bind_t<boost::_bi::unspecified, extern "C" int(*)(DIR*), boost::_bi::list1<boost::_bi::value<DIR*>>>.
"ext/common/ApplicationPool2/Spawner.h", line 250: Where: Specialized in non-template code.
"ext/boost/bind/bind.hpp", line 69: Error: result_type is not defined.
"ext/boost/bind/bind_template.hpp", line 15: Where: While specializing "boost::_bi::result_traits<boost::_bi::unspecified, extern "C" int(*)(DIR*)>".
"ext/boost/bind/bind_template.hpp", line 15: Where: Specialized in boost::_bi::bind_t<boost::_bi::unspecified, extern "C" int(*)(DIR*), boost::_bi::list1<boost::_bi::value<DIR*>>>.
"ext/common/ApplicationPool2/Spawner.h", line 250: Where: Specialized in non-template code.

有问题的代码在这里:

56  // result_traits
57
58 template<class R, class F> struct result_traits
59 {
60 typedef R type;
61 };
62
63 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
64
65 struct unspecified {};
66
67 template<class F> struct result_traits<unspecified, F>
68 {
69 typedef typename F::result_type type;
70 };
71
72 template<class F> struct result_traits< unspecified, reference_wrapper<F> >
73 {
74 typedef typename F::result_type type;
75 };
76
77 #endif

boost 故障单: https://svn.boost.org/trac/boost/ticket/9250

boost bind.hpp源码: http://www.boost.org/doc/libs/1_54_0/boost/bind/bind.hpp

Phusion乘客跟踪问题: https://code.google.com/p/phusion-passenger/issues/detail?id=982

最佳答案

来自 https://svn.boost.org/trac/boost/ticket/9250

"ext/common/ApplicationPool2/Spawner.h", line 250 should contain something like
boost::bind(closedir, ...). It needs to be changed to
boost::bind<int>(closedir, ...). The problem is that on this compiler extern "C"
functions are distinct from ordinary C++ functions.

http://www.boost.org/doc/libs/1_54_0/libs/bind/bind.html#Q_extern_C

在昨天追逐了一大堆 C++ 模板搜索结果之后,我有点不安,修复这么简单:)

关于c++ - boost bind.hpp 1.54 c++ 专用模板无法在 Solaris 上编译。有效的 C++?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19393403/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com