fork download
  1. #import <objc/objc.h>
  2. #import <objc/Object.h>
  3. #import <Foundation/Foundation.h>
  4.  
  5. @interface Person : NSObject
  6. @property NSString *firstName;
  7. @property NSString *lastName;
  8. - (void)printName;
  9. - (void)printNameWith:(NSString*)name;
  10. @end
  11.  
  12. @implementation Person
  13. - (void)printName
  14. {
  15. NSLog(@”Person name is: %@”,
  16. self.firstName);
  17. }
  18. @end
  19.  
  20. @implementation TestObj
  21. int main()
  22. {
  23. printf("elo");
  24. return 0;
  25. }
  26. @end
Compilation error #stdin compilation error #stdout 0s 115136KB
stdin
Standard input is empty
compilation info
prog.m:6:1: warning: no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed [-Wobjc-property-no-attribute]
@property NSString *firstName;
^
prog.m:6:1: warning: default property attribute 'assign' not appropriate for non-GC object [-Wobjc-property-no-attribute]
prog.m:7:1: warning: no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed [-Wobjc-property-no-attribute]
@property NSString *lastName;
^
prog.m:7:1: warning: default property attribute 'assign' not appropriate for non-GC object [-Wobjc-property-no-attribute]
prog.m:15:8: error: non-ASCII characters are not allowed outside of literals and identifiers
NSLog(@”Person name is: %@”,
       ^
prog.m:15:29: error: non-ASCII characters are not allowed outside of literals and identifiers
NSLog(@”Person name is: %@”,
                          ^
prog.m:15:7: error: unexpected '@' in program
NSLog(@”Person name is: %@”,
      ^
prog.m:12:17: warning: property 'firstName' requires method 'firstName' to be defined - use @synthesize, @dynamic or provide a method implementation in this class implementation [-Wobjc-property-implementation]
@implementation Person
                ^
prog.m:6:21: note: property declared here
@property NSString *firstName;
                    ^
prog.m:12:17: warning: property 'firstName' requires method 'setFirstName:' to be defined - use @synthesize, @dynamic or provide a method implementation in this class implementation [-Wobjc-property-implementation]
@implementation Person
                ^
prog.m:6:21: note: property declared here
@property NSString *firstName;
                    ^
prog.m:12:17: warning: property 'lastName' requires method 'lastName' to be defined - use @synthesize, @dynamic or provide a method implementation in this class implementation [-Wobjc-property-implementation]
@implementation Person
                ^
prog.m:7:21: note: property declared here
@property NSString *lastName;
                    ^
prog.m:12:17: warning: property 'lastName' requires method 'setLastName:' to be defined - use @synthesize, @dynamic or provide a method implementation in this class implementation [-Wobjc-property-implementation]
@implementation Person
                ^
prog.m:7:21: note: property declared here
@property NSString *lastName;
                    ^
prog.m:12:17: warning: method definition for 'printNameWith:' not found [-Wincomplete-implementation]
@implementation Person
                ^
prog.m:9:1: note: method 'printNameWith:' declared here
- (void)printNameWith:(NSString*)name;
^
prog.m:20:17: warning: cannot find interface declaration for 'TestObj'
@implementation TestObj
                ^
prog.m:20:17: warning: class 'TestObj' defined without specifying a base class [-Wobjc-root-class]
prog.m:20:24: note: add a super class to fix this problem
@implementation TestObj
                       ^
                        : NSObject 
11 warnings and 3 errors generated.
stdout
Standard output is empty