问题
I kept getting the following linker error when i try using Core Plot in my project...
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
any idea how can i fix this? i have been trying over 2 hours already...
I have downloded other examples but i m still getting the same linker error.
Appreciate any help...
回答1:
I got the same error as you and my problem was that I had not added the QuartzCore framework (select your project target, expand "Link binaries with libraries", click '+' to select QuartzCore.framework).
回答2:
Is this in xcode 4? You might want to make sure that you have the latest version of core plot. Xcode 4 caused a problem for me until I downloaded the latest version of core-plot and removed the previous directory.
I open the touch project and rebuilt then the linked was OK again!
回答3:
Add coreplotHeaders library from zip file downloaded from google code and also add libCoreplot-CocoaTouch.a to your project template.
NB:when adding don't create folder references for folders added.
来源:https://stackoverflow.com/questions/5685363/using-core-plot-iphone-linker-error