当我在项目中尝试使用Core Plot时,我一直收到以下链接器错误...
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CPXYGraph", referenced from:
objc-class-ref in CorePlotImplViewController.o
"_OBJC_CLASS_$_CPPlotRange", referenced from:
objc-class-ref in CorePlotImplViewController.o
"_OBJC_CLASS_$_CPLineStyle", referenced from:
objc-class-ref in CorePlotImplViewController.o
"_OBJC_CLASS_$_CPColor", referenced from:
objc-class-ref in CorePlotImplViewController.o
"_OBJC_CLASS_$_CPScatterPlot", referenced from:
objc-class-ref in CorePlotImplViewController.o
"_OBJC_CLASS_$_CPPlotSymbol", referenced from:
objc-class-ref in CorePlotImplViewController.o
"_OBJC_CLASS_$_CPFill", referenced from:
objc-class-ref in CorePlotImplViewController.o
".objc_class_name_NSNumber", referenced from:
pointer-to-literal-objc-class-name in libCorePlot.a(CPPlot.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPScatterPlot.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPBarPlot.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPUtilities.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPTradingRangePlot.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPPieChart.o)
".objc_class_name_NSMutableDictionary", referenced from:
pointer-to-literal-objc-class-name in libCorePlot.a(CPPlot.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPTheme.o)
".objc_class_name_NSDecimalNumber", referenced from:
pointer-to-literal-objc-class-name in libCorePlot.a(CPPlot.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPScatterPlot.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPBarPlot.o)
pointer-to-literal-objc-class-name in libCorePlot.a(NSNumberExtensions.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPUtilities.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPPlotRange.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPAxis.o)
...
".objc_class_name_NSMutableArray", referenced from:
pointer-to-literal-objc-class-name in libCorePlot.a(CPPlot.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPScatterPlot.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPBarPlot.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPGraph.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPTradingRangePlot.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPPieChart.o)
".objc_class_name_NSArray", referenced from:
pointer-to-literal-objc-class-name in libCorePlot.a(CPPlot.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPScatterPlot.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPBarPlot.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPGraph.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPAxisSet.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPTheme.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPTradingRangePlot.o)
...
".objc_class_name_NSException", referenced from:
pointer-to-literal-objc-class-name in libCorePlot.a(CPScatterPlot.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPBarPlot.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPGraph.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPGradient.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPLayer.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPXYPlotSpace.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPTheme.o)
...
".objc_class_name_NSNull", referenced from:
pointer-to-literal-objc-class-name in libCorePlot.a(CPScatterPlot.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPBarPlot.o)
".objc_class_name_NSValueTransformer", referenced from:
pointer-to-literal-objc-class-name in libCorePlot.a(CPScatterPlot.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPTradingRangePlot.o)
".objc_class_name_NSObject", referenced from:
.objc_class_name_CPPlotSymbol in libCorePlot.a(CPPlotSymbol.o)
.objc_class_name_CPPlotSpace in libCorePlot.a(CPPlotSpace.o)
.objc_class_name_CPPlotRange in libCorePlot.a(CPPlotRange.o)
.objc_class_name_CPFill in libCorePlot.a(CPFill.o)
.objc_class_name_CPGradient in libCorePlot.a(CPGradient.o)
.objc_class_name_CPImage in libCorePlot.a(CPImage.o)
.objc_class_name_CPLineStyle in libCorePlot.a(CPLineStyle.o)
...
".objc_class_name_NSNotificationCenter", referenced from:
pointer-to-literal-objc-class-name in libCorePlot.a(CPGraph.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPXYPlotSpace.o)
".objc_class_name_NSString", referenced from:
pointer-to-literal-objc-class-name in libCorePlot.a(CPUtilities.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPPlotRange.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPLayer.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPAxis.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPTextLayer.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPAxisLabel.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPAxisTitle.o)
...
".objc_class_name_NSScanner", referenced from:
pointer-to-literal-objc-class-name in libCorePlot.a(CPUtilities.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPAxis.o)
".objc_class_name_NSLocale", referenced from:
pointer-to-literal-objc-class-name in libCorePlot.a(CPPlotRange.o)
".objc_class_name_UIColor", referenced from:
pointer-to-literal-objc-class-name in libCorePlot.a(CPPlatformSpecificCategories.o)
pointer-to-literal-objc-class-name in libCorePlot.a(CPLayerHostingView.o)
".objc_class_name_NSMutableData", referenced from:
pointer-to-literal-objc-class-name in libCorePlot.a(CPLayer.o)
".objc_class_name_CALayer", referenced from:
.objc_class_name_CPLayer in libCorePlot.a(CPLayer.o)
".objc_class_name_NSMutableSet", referenced from:
pointer-to-literal-objc-class-name in libCorePlot.a(CPAxis.o)
".objc_class_name_NSNumberFormatter", referenced from:
pointer-to-literal-objc-class-name in libCorePlot.a(CPAxis.o)
.objc_class_name_CPTimeFormatter in libCorePlot.a(CPTimeFormatter.o)
".objc_class_name_NSSet", referenced from:
pointer-to-literal-objc-class-name in libCorePlot.a(CPAxis.o)
".objc_class_name_UIView", referenced from:
.objc_class_name_CPLayerHostingView in libCorePlot.a(CPLayerHostingView.o)
".objc_class_name_NSDateFormatter", referenced from:
pointer-to-literal-objc-class-name in libCorePlot.a(CPTimeFormatter.o)
".objc_class_name_NSDate", referenced from:
pointer-to-literal-objc-class-name in libCorePlot.a(CPTimeFormatter.o)
".objc_class_name_UIFont", referenced from:
pointer-to-literal-objc-class-name in libCorePlot.a(CPTextStylePlatformSpecific.o)
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
任何想法我该如何解决这个问题?我已经尝试了2个多小时......
我已下载其他示例,但我仍然遇到相同的链接器错误。
感谢任何帮助...
答案 0 :(得分:2)
我得到了和你一样的错误,我的问题是我没有添加QuartzCore框架(选择你的项目目标,展开“用库链接二进制文件”,点击“+”选择QuartzCore.framework)。
答案 1 :(得分:1)
这是在xcode 4中吗?您可能希望确保拥有最新版本的核心图。 Xcode 4给我带来了一个问题,直到我下载了最新版本的核心图并删除了以前的目录。
我打开触摸项目并重建,然后链接再次正常!
答案 2 :(得分:1)
从谷歌代码下载的zip文件中添加coreplotHeaders库,并将libCoreplot-CocoaTouch.a添加到项目模板中。
注意:添加时不要为添加的文件夹创建文件夹引用。