【发布时间】:2017-02-17 01:33:54
【问题描述】:
我正在开发一个项目,该项目结合了使用 Boost 的 C++ 类和目标 C 类。当我为在 C++ 中使用 Objective C 类编写一个包装器时,我能够构建它,但是当我在 Objective C 中为 C++ 类编写一个包装器时,项目无法在 boost/thread.hpp 中构建并出现语义错误。 更具体地说,在 boost/type_traits/detail/mp_defer.hpp
我正在使用支持 C++11 的 LLVM C++
我按照下面的链接来包装跨语言类。 http://philjordan.eu/article/mixing-objective-c-c++-and-objective-c++
我参考了以下帖子,但没有解决我的问题。 Use boost library in cocoa project
以下是错误列表:
struct mp_valid_impl
{
template<template<class...> class G, class = G<T...>>
static boost::true_type check(int); //use of undeclared identifier check
template<template<class...> class>
static boost::false_type check(...);
using type = decltype(check<F>(0));//Cannot refer to class template F without template argument list
};
template<template<class...> class F, class... T>
using mp_valid = typename mp_valid_impl<F, T...>::type; //No type named boost in 'boost::type_traits_detail::m_valid_impl< ...... >
其他故障日志:
-
/usr/local/boost/include/boost/type_traits/detail/mp_defer.hpp:37:1:'boost::type_traits_detail::mp_valid_impl'中没有名为'type'的类型
-
/usr/local/boost/include/boost/type_traits/detail/mp_defer.hpp:37:1:'boost::type_traits_detail::mp_valid_impl'中没有名为'type'的类型
/usr/local/boost/include/boost/thread/pthread/timespec.hpp:52:42:二进制表达式的操作数无效('const chrono::nanoseconds'(又名'const duration >')和'typename boost::enable_if > >, duration > >::type'(又名'boost::chrono::duration >'))
/usr/local/boost/include/boost/chrono/duration.hpp:405:62:在“boost::common_type”中没有名为“type”的类型
/usr/local/boost/include/boost/thread/pthread/condition_variable_fwd.hpp:239:38:二进制表达式 ('time_point' (aka 'time_point') 和 'steady_clock::time_point 的操作数无效'(又名'time_point'))
/usr/local/boost/include/boost/chrono/duration.hpp:559:17:如果没有转换运算符,则无法将“const duration >”转换为“CD”(又名“int”)
-
/usr/local/boost/include/boost/type_traits/detail/mp_defer.hpp:37:1:'boost::type_traits_detail::mp_valid_impl'中没有名为'type'的类型
我一直在网上阅读并尝试了几个小时,请帮助。 谢谢
【问题讨论】:
-
我回答了您的问题,但您应该在此处发布完整的错误日志以确保该答案正确。
-
@NulledPointer 我的文件扩展名是 .mm,我还指定了文件类型为 Objective C++ Source
标签: c++ objective-c boost objective-c++ boost-thread