我有一个包含数字 ivars 的类:
// Answer.h
#import <Foundation/Foundation.h>
@interface Answer : NSObject{
@public
int firstNumber;
int secondNumber;
char myOperator;
}
@end
我尝试在此处访问代码
numberGroup->firstNumber = arc4random() % 1;
numberGroup->secondNumber = arc4random() % 10;
numberGroup->myOperator = arc4random() % 4;
我得到这个错误:
ld /Users/jack/Library/Developer/Xcode/DerivedData/PowerBuilders-emehzkfcgntrhofxhvurovjmnugn/Build/Products/Debug-iphonesimulator/PowerBuilders.app/PowerBuilders normal i386 cd "/Users/jack/Desktop/Xcode/Assorted Apps/PowerBuilders" setenv MACOSX_DEPLOYMENT_TARGET 10.6 setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.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 i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator .platform/Developer/SDKs/iPhoneSimulator5.1。sdk -L/Users/jack/Library/Developer/Xcode/DerivedData/PowerBuilders-emehzkfcgntrhofxhvurovjmnugn/Build/Products/Debug-iphonesimulator -F/Users/jack/Library/Developer/Xcode/DerivedData/PowerBuilders-emehzkfcgntrhofxhvurovjmnugn/Build/Products/ Debug-iphonesimulator -filelist /Users/jack/Library/Developer/Xcode/DerivedData/PowerBuilders-emehzkfcgntrhofxhvurovjmnugn/Build/Intermediates/PowerBuilders.build/Debug-iphonesimulator/PowerBuilders.build/Objects-normal/i386/PowerBuilders.LinkFileList -mmacosx- version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50100 -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/jack/Library/Developer/Xcode/DerivedData/PowerBuilders- emehzkfcgntrhofxhvurovjmnugn/Build/Products/Debug-iphonesimulator/PowerBuilders。应用程序/PowerBuilders
体系结构 i386 的未定义符号:
“_OBJC_IVAR_$_Answer.firstNumber”,引用自:ViewController.o 中的-[ViewController 第 1 课]“_OBJC_IVAR_$_Answer.myOperator”,引用自:ViewController.o 中的-[ViewController 第 1 课]“_OBJC_IVAR_$_Answer .secondNumber”,引用自:ViewController.old 中的 -[ViewController 课程 1]:未找到架构 i386 的符号:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)