链接Boost在Objective C和c++结合xcode项目
Linking Boost in Objective C and C++ combined xcode project
我正在做一个项目,它结合了使用Boost和objective C类的c++类。当我在c++中编写使用Objective C类的包装器时,我能够构建它,但是当我在Objective C中编写c++类的包装器时,该项目无法在boost/thread.hpp中构建语义错误。更具体地说,在boost/type_traits/detail/mp_deff .hpp
我正在使用LLVM c++与c++ 11支持
我正在跟随下面的链接来包装跨语言课程。http://philjordan.eu/article/mixing-objective-c-c + + -and-objective-c + +
我参考了下面的帖子,但没有解决我的问题。在cocoa项目中使用boost库
下面是错误列表:
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_deff .hpp:37:1:在'boost::type_traits_detail::mp_valid_impl'中没有名为'type'的类型
/usr/local/boost/include/boost/type_traits/detail/mp_deff .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: 2339:38:二进制表达式('time_point'(又名'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_deff .hpp:37:1:在'boost::type_traits_detail::mp_valid_impl'中没有名为'type'的类型
我一直在网上阅读和尝试几个小时,请帮助。由于
A)文件扩展名
LLVM-clang会自动理解文件扩展名,并使用正确的参数clang
编译程序。
将文件重命名为.mm
扩展名
或者用-x objective-c++
选项编译
CXXLAGS += -x objective-c++
B)标头包含
如果您缺少include头,那么您需要添加以下
CXXLAGS += -I/path/to/boost/
/path/to/boost
是编译后的boost库目录。
1.61版本的boost线程库似乎与LLVM-clang中的Objective c++不兼容。我改用本地c++ Thread,用基于Boost-thread的线程类代替。
- 多态性和功能结合
- 将 Vulkan 与 SFML 结合使用?
- 将 c++ 生成器应用程序与外部 dll 结合使用
- 如何将增强MSM与增强信号结合使用?
- MS Visual Studio 解决方案结合了非托管C++项目和 C# 项目
- 函数未在作用域中声明 / 如何结合使用 header.h、header.cpp 和 main.cpp?
- 将预编译的 C 共享库与 JNI/NDK 结合使用
- C++ 将函数指针与最佳性能相结合
- 将 Lua 与 C++ DLL 结合使用
- 为什么push_back和emplace_back结合在一起时,会有不同的行为
- 将 aws-iot-device-sdk-cpp-v2 与 CMake 结合使用
- 将2个欧拉角与GLM相结合的问题
- 结合std::execution和OpenMP是否可取
- 抽象和派生与std::list相结合
- 想要将 CGAL 与四元数相结合是否合乎逻辑
- 存储/传递 v8 承诺解析器供以后使用的最佳实践?(结合C++线程)
- 如何将 IAudioClient3 (WASAPI) 与实时工作队列 API 结合使用
- 可变参数模板与默认模板参数相结合
- 函数与返回类型 node* 与 C++ 中的 OOP 结合使用
- 是否可以将C++与任何语言相结合?