4

我的项目包含带有 Xcode 7.3 的 Swift 2.2、Objective C 和 C++

我在生成的 ProducModuleName-Swift.h 文件中收到以下错误

Typedef redefinition with different types ('uint_least16_t' (aka 'unsigned short') vs 'char16_t')
Typedef redefinition with different types ('uint_least32_t' (aka 'unsigned int') vs 'char32_t')

在下一节

if !defined(SWIFT_TYPEDEFS)
# define SWIFT_TYPEDEFS 1
# if defined(__has_include) && __has_include(<uchar.h>)
#  include <uchar.h>
# elif !defined(__cplusplus) || __cplusplus < 201103L
typedef uint_least16_t char16_t;
typedef uint_least32_t char32_t;
# endif

我可以通过将我的 C++ 参数更改为 C++ 11 来绕过错误,这将跳过这个麻烦的代码。

但是我想知道是否有更清洁的解决方案。

**在此处输入图片描述**

为了澄清上面的代码是XCode在编译时生成的代码。我无法控制这段代码

4

0 回答 0