Objective-C:typedef NS_ENUM错误

时间:2012-12-03 08:50:07

标签: objective-c ios enums typedef

我在iOS-App中使用了typedef NS_ENUM,我收到此错误:“链接器命令失败,退出代码为1”。通常这很容易修复,但这次我找不到解决方案......

这是我的NS_Enum:

typedef NS_ENUM(NSInteger, MKIGridViewSelectionStyle)
            MKIGridViewSelectionStyle_SelectCellOnly = 1,
            MKIGridViewSelectionStyle_SelectCompleteRow = 2,
            MKIGridViewSelectionStyle_SelectCompleteColumn = 3;

编辑:

完整的消息:

  

Ld /Users/mki/Library/Developer/Xcode/DerivedData/GridViewTest-esfqwoooiarqpchfzsazwbgckmso/Build/Products/Debug-iphoneos/GridViewTest.app/GridViewTest normal armv7s       cd / Users / mki / Desktop / GridViewTest       setenv IPHONEOS_DEPLOYMENT_TARGET 5.0       SETENV PATH“/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/ usr / sbin目录:/ sbin目录”       /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6。 0.sdk -L / Users / mki / Library / Developer / Xcode / DerivedData / GridViewTest-esfqwoooiarqpchfzsazwbgckmso / Build / Products / Debug-iphoneos -F / Users / mki / Library / Developer / Xcode / DerivedData / GridViewTest-esfqwoooiarqpchfzsazwbgckmso / Build / Products / Debug-iphoneos -filelist /Users/mki/Library/Developer/Xcode/DerivedData/GridViewTest-esfqwoooiarqpchfzsazwbgckmso/Build/Intermediates/GridViewTest.build/Debug-iphoneos/GridViewTest.build/Objects-normal/armv7s/GridViewTest.LinkFileList - dead_strip -fobjc-arc -fobjc-link-runtime -miphoneos-version-min = 5.0 -framework QuartzCore -framework AudioToolbox -framework UIKit -framework Foundation -framework CoreGraphics -o / Users / mki / Library / Developer / Xcode / DerivedData / GridViewTest -esfqwoooiarqpchfzsazwbgckmso /编译/产品/调试-的iPhoneOS / GridViewTest.app /石墨idViewTest

     

重复符号_MKIGridViewSelectionStyle_SelectCellOnly in:       /Users/mki/Library/Developer/Xcode/DerivedData/GridViewTest-esfqwoooiarqpchfzsazwbgckmso/Build/Intermediates/GridViewTest.build/Debug-iphoneos/GridViewTest.build/Objects-normal/armv7s/MKIViewController.o       /Users/mki/Library/Developer/Xcode/DerivedData/GridViewTest-esfqwoooiarqpchfzsazwbgckmso/Build/Intermediates/GridViewTest.build/Debug-iphoneos/GridViewTest.build/Objects-normal/armv7s/MKIGridView.o   ld:架构armv7s clang的3个重复符号:错误:链接器   命令失败,退出代码为1(使用-v查看调用)

MAIK

1 个答案:

答案 0 :(得分:12)

您忘记在值定义周围使用大括号。

typedef NS_ENUM(NSInteger, MKIGridViewSelectionStyle) {
        MKIGridViewSelectionStyle_SelectCellOnly = 1,
        MKIGridViewSelectionStyle_SelectCompleteRow = 2,
        MKIGridViewSelectionStyle_SelectCompleteColumn = 3
};