Does anyone know why this code is running into compilation errors? I\'m compiling it on Catalina using clang. I posted a similar issue here but that was when I was trying to c
This works on my system (macOS):
#import
@interface A: NSObject
@property int a;
@end
@implementation A {
int a;
}
@synthesize a;
-(int) getMyValue {
return a;
}
@end
int main () {
@autoreleasepool {
A *a = [[A alloc] init];
[a setA:99];
NSLog (@"value = %d", [a getMyValue]);
}
return 0;
}
If file is saved as synth.m the terminal command is: clang synth.m -framework Foundation -o synth && ./synth