gpt4 book ai didi

Objective-C:typedef NS_ENUM 错误

转载 作者:可可西里 更新时间:2023-11-01 05:04:05 27 4
gpt4 key购买 nike

我在 iOS 应用程序中使用 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/Build/Products/Debug-iphoneos/GridViewTest.app/GridViewTest

duplicate symbol _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: 3 duplicate symbols for architecture armv7s clang: error: linker command failed with exit code 1 (use -v to see invocation)

迈克

最佳答案

您忘记在值定义两边使用大括号。

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

关于Objective-C:typedef NS_ENUM 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13679826/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com