iphone - CLANG 给出错误,提示头文件有缺陷 UILocalizedIndexedCollat​​ion.h

标签 iphone clang

我在使用 CLANG 构建代码时遇到了此错误:

In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:31,
                 from /Users/waspfish/Documents/NanaimoStudio/Projects/iPhoneMonk/Projects/IdeaOrganizer/IdeaOrganizer_Prefix.pch:13,
                 from :1:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UILocalizedIndexedCollation.h:13: error: syntax error before ‘AT_NAME’ token
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UILocalizedIndexedCollation.h:21: error: syntax error before ‘}’ token
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UILocalizedIndexedCollation.h:23: fatal error: method definition not in @implementation context
compilation terminated.
{standard input}:32:FATAL:.abort  detected.  Assembly stopping.

我最终不得不从 UIKit.h 中排除 UILocalizedIndexedCollat​​ion.h,一切都构建得很好。知道是什么导致了这个问题吗?我无法想象 Apple 会发布一个有缺陷的头文件。

最佳答案

问题来自 SDK 3.0,现在使用 gcc 4.2,但 scan-build 仍然使用/usr/bin/gcc。所以你需要告诉 scan-build 使用/usr/bin/gcc-4.2 代替。

scan-build --use-cc=/usr/bin/gcc-4.2 xcodebuild -configuration Debug

瞧瞧!

关于iphone - CLANG 给出错误,提示头文件有缺陷 UILocalizedIndexedCollat​​ion.h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1078001/

相关文章:

c++ - 编译器创建的成员函数的实际参数列表是什么?

c - Clang 编译器的 C 枚举的数据类型是什么?

c++ - 引用基类的 constexpr 构造函数因编译器而异

c# - C++ 和 C# 可以用于 iPhone 应用程序吗

objective-c - 如何在 IOS 8 中设置 UIAlertController 的高度和宽度

ios - UIScrollView 不滚动

c++ - Visual Studio 和 Clang 不会抛出 std::bad_array_new_length

ios - CGBitmapInfo 值在 iOS 上的表现

javascript - Cordova iOS 在单个页面上将屏幕方向更改为横向

xcode - 如何获得Xcode “clang”编译时错误的调用?