discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objective-C newbie programming question


From: Andy Ruder
Subject: Re: Objective-C newbie programming question
Date: Fri, 17 Jan 2003 09:47:09 -0600
User-agent: Mutt/1.4i

On Fri, Jan 17, 2003 at 04:05:14PM +0100, Dennis Leeuw wrote:
> 
> bash-2.05a$ gcc -c hello.m -lobjc       
> hello.m: In function `main':
> hello.m:24: warning: return type of `main' is not `int'
> gcc: -lobjc: linker input file unused because linking not done


Some compilers insist on main() returning int or they give a warning.
In this case, you would just change it to return int, and then put
return 0; at the end of the main() function so that it doesn't complain.

Also, -c instructs the compiler not to link it and to just compile the
.o (object) file.  .o files are just the building blocks of an executable,
and cannot be run until you have linked them.

Just get rid of the -c and then add a -o hello:

gcc hello.m -o hello -lobjc

should work fine if you have everything set up correctly.

Then run with:

./hello

- Andrew Ruder




reply via email to

[Prev in Thread] Current Thread [Next in Thread]