【问题标题】:Core Plot 1.1: Compile error when compiling Core Plot ExamplesCore Plot 1.1:编译 Core Plot 示例时出现编译错误
【发布时间】:2013-01-25 13:06:27
【问题描述】:

尝试在 Xcode 4.6 中编译以下 CorePlot 1.1 示例时,出现编译器错误。

  • DatePlot
  • CPTTestApp - iPad

CPTUtilities.m 中的编译器错误:Operand of ? changes signedness: 'int' to 'NSUInteger' (aka 'unsigned int')

NSRange CPTExpandedRange(NSRange range, NSInteger expandBy)
{
    NSUInteger loc = MAX(0, (NSInteger)range.location - expandBy);
    NSUInteger lowerExpsion = range.location - loc; // Here is the error
    NSUInteger length = (NSUInteger)( (NSInteger)(range.length + lowerExpansion) + expandBy);

    return NSMakeRange(loc, length);
}

【问题讨论】:

  • 显示如何调用 CPTExpandedRange 函数。
  • 我只是打开示例文件并编译它(对于 Mac OSX 64 位)。可以编译Core Plot 1.1的示例文件吗?
  • 这听起来像 Xcode 4.6 beta 中的新 LLVM 版本可能会在这里提出更严格的警告。要么退回到当前稳定的 Xcode 4.5 版本,要么在 Core Plot 邮件列表中将其报告为错误:groups.google.com/group/coreplot-discuss
  • 我尝试在您的 Google 网上论坛网站上提交错误报告,但收到来自 Google 网上论坛的错误:There was an error posting the message to the group. Please try again later。 Google Groups 似乎也有一些错误... :-) 请您将其报告为 Core Plot 错误?
  • 实际问题跟踪器在这里:code.google.com/p/core-plot/issues/list,但 Google 网上论坛邮件列表就是这样,一个邮件列表。您可以简单地向它发送电子邮件。我已经一年多没有参与这个项目了。

标签: ios objective-c cocoa-touch core-plot


【解决方案1】:

是的,答案放在那里,只是改了功能而已,我留了一份,说的对的代码怎么样:

    NSRange CPTExpandedRange(NSRange range, NSInteger expandBy)

//NSUInteger loc            = MAX(0, (NSInteger)range.location - expandBy);
//NSUInteger lowerExpansion = range.location - loc;
//NSUInteger length         = (NSUInteger)( (NSInteger)(range.length + lowerExpansion) + expandBy );

NSInteger loc            = MAX(0, (NSInteger)range.location - expandBy);
NSInteger lowerExpansion = (NSInteger)range.location - loc;
NSInteger length         = MAX(0, (NSInteger)range.length + lowerExpansion + expandBy);

//return NSMakeRange(loc, length);
return NSMakeRange( (NSUInteger)loc, (NSUInteger)length );

【讨论】:

    【解决方案2】:

    Core Plot 团队现已修复此问题(问题 #501):

    Issue 501 fixed

    【讨论】:

    • 今天用最新的 (1.1) 编译,但仍然存在问题
    • 必须通过 hg clone 下载而不是下载部分 1.1 版本
    【解决方案3】:

    抱歉,我找不到如何修复此编译器错误。我和亚历克斯的情况一样。 尝试编译示例并得到相同的错误。 在 XCode 4.6 和 Mountain Lion 上运行。 CorePlot 1.1 并尝试过目标 5.1、6.0 和 6.1

    感谢您的帮助。

    【讨论】:

    • 您是否从存储库下载了最新的源代码版本? “正常”的 Core Plot 1.1 下载包含错误。您必须手动下载最新的源代码版本。
    • @AlexR:这是他们所做的更改:code.google.com/p/core-plot/source/…
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-26
    • 1970-01-01
    • 1970-01-01
    • 2016-03-15
    • 2021-11-01
    • 1970-01-01
    相关资源
    最近更新 更多