- Joined
- May 22, 2011
- Messages
- 10
- Reaction score
- 0
- Points
- 1
Hi everyone,
I know there is a lot of threads with this topic but they didnt help me.
So, I installed the Xcode3 with the gcc 4.2 and created a simple hello world example.
Then, I built it with the command:
no problem until here.
Then, when i tried to run this example:
I got this:
I got this same errors with others examples.
Am I missing something? I think gcc is working fine. Could anyone try to run this example and tell me what happens?
thx in advanced!
I know there is a lot of threads with this topic but they didnt help me.
So, I installed the Xcode3 with the gcc 4.2 and created a simple hello world example.
Code:
#import <stdio.h>
int main( int argc, const char *argv[] ) {
printf( "hello world\n" );
return 0;
}
Then, I built it with the command:
Code:
gcc -lobjc hello.m -o hello
Then, when i tried to run this example:
Code:
/* Comments:
** Example written by Pascal Bourguignon
** return status change by Chris B. Vetter
** Added comments in empty {} section by Chris B. Vetter
** int main() changed to int main(void) by Dennis Leeuw
** from comments by Chris B. Vetter
*/
#include <objc/Object.h>
@interface Greeter:Object
{
/* This is left empty on purpose:
** Normally instance variables would be declared here,
** but these are not used in our example.
*/
}
- (void)greet;
@end
#include <stdio.h>
@implementation Greeter
- (void)greet
{
printf("Hello, World!\n");
}
@end
#include <stdlib.h>
int main(void)
{
id myGreeter;
myGreeter=[Greeter new];
[myGreeter greet];
[myGreeter free];
return EXIT_SUCCESS;
}
Code:
MacBikka:Desktop bikka$ gcc -lobjc Greater.m -o Greater
Greater.m: In function ‘main’:
Greater.m:40: warning: ‘Greeter’ may not respond to ‘+new’
Greater.m:40: warning: (Messages without a matching method signature
Greater.m:40: warning: will be assumed to return ‘id’ and accept
Greater.m:40: warning: ‘...’ as arguments.)
Greater.m:44: warning: no ‘-free’ method found
Am I missing something? I think gcc is working fine. Could anyone try to run this example and tell me what happens?
thx in advanced!