c++ Boost Mix with objective-c

c++ Boost Mix with objective-c

本文关键字:objective-c with Mix Boost c++      更新时间:2023-10-16

我正在尝试使用boosts构建c ++项目。我创建了一个使用 OSX-SDK-9 的 objective-c++ 类,我计划从普通的 c++ 类中得到提升,包括。使用 SDK 框架的对象 c++:

AppKit.framework
CoreGraphics.framework

它包含

#include <ApplicationServices/ApplicationServices.h>
#include <Carbon/Carbon.h>
#include <AppKit/AppKit.h>
#include <AppKit/NSEvent.h>

当我将 object-c++ 的包含添加到提升类时,我看到编译错误错误当我删除提升包括构建成功时

引导在静态库中编译

使用以下参数生成代码

xcode 6.3.2(6D2105)
compiler Apple LLVM6.1
GUN++11 [-std=gun++11]
libc++(LLVM c++ standard library with c++11 support)

我做错了什么?我如何在同一个程序中使用 c++ boost 和 OSK SDK

看起来这是 Boost 的集合类型和碳收集管理器之间的名称冲突。

"集合"在此标头中定义:

#include <CarbonCore/Collections.h>

并且符号"集合"在提升的几个地方使用。

构建日志应显示导致问题的确切提升标头。您可以包含较小的 boost 标头子集以避免"集合"符号,或者可以在单独的源代码文件中编写使用 boost 的函数以避免冲突。

在 Boost 标头之前包含 AppKit 标头可以解决此特定问题。

另一个问题会出现——expected unqualified-id,可以通过以下方式解决——

#include <AppKit/AppKit.h>
#undef nil
#include "boost headers here"
#define nil nullptr