This works fine when copied and pasted in to a new XCode Cocoa-based Command Line Tool project. The only difference is I added your code in to the @autoreleasepool
:
Main.m
#import <Foundation/Foundation.h>
#import "Car.h"
int main(int argc, const char * argv[])
{
@autoreleasepool {
int y;
//Creo un nuovo oggetto
Car *myCar = [[Car alloc] init];
//Setto i parametri
[myCar setBrand: @"BMW Z4"];
NSLog (@"Inserisci data modello: ");
scanf (" %i", &y); //E' buona norma lasciare uno spazio
[myCar setYear: y];
//Stampo a video i dati
NSLog(@"Marca: %@ Anno: %i", [myCar brand], [myCar year]);
}
return 0;
}
The answer by @Martin R. above indicates you're using GNUStep instead of XCode, so you may wish to add that tag, or seek advice specifically on GNUStep forums or chat rooms.