PDA

View Full Version : Cant Compile




dieseltwitch
Jan 4, 2009, 01:02 PM
I learning to write C code but i cant compile from the Xcode Program (this is the one i got for the iPhone Dev Kit, not sure if that makes a difference) but after i write the small program "hello World" i go to compile and its grayed out. what gives? what did i do wrong?



robbieduncan
Jan 4, 2009, 01:07 PM
Tell us, exactly, how you created your project. Note if you did not start with a new project then you can't compile from within XCode. Creating a new C file or whatever outside a project will not work...

dieseltwitch
Jan 4, 2009, 01:58 PM
then thats my problem! i just started a new file not a project.

2nd question what is the command for running the complier in the terminal on mac. i know it cl blablabla.c on windows but whats the mac =

Cromulent
Jan 4, 2009, 02:19 PM
then thats my problem! i just started a new file not a project.

2nd question what is the command for running the complier in the terminal on mac. i know it cl blablabla.c on windows but whats the mac =

gcc -o programname filename.c

dieseltwitch
Jan 4, 2009, 02:46 PM
gcc -o programname filename.c

Ok so i tried gcc -0 hello hello.c
and it makes a second file with no ext. what ext do i use to for the out put file? In windows it makes a exe file what does it make in the mac os?

wrldwzrd89
Jan 4, 2009, 02:48 PM
Ok so i tried gcc -0 hello hello.c
and it makes a second file with no ext. what ext do i use to for the out put file? In windows it makes a exe file what does it make in the mac os?
Mac OS executables actually don't have any extension at all.

dieseltwitch
Jan 4, 2009, 02:51 PM
then how do i run it from the cmd line? when i type hello (the name of the output file it just faults out "-bash .........."

wrldwzrd89
Jan 4, 2009, 02:51 PM
then how do i run it from the cmd line? when i type hello (the name of the output file it just faults out "-bash .........."
./hello

dieseltwitch
Jan 4, 2009, 02:53 PM
thank you much! sorry for sounding like such a newbie! gota start some where

Cromulent
Jan 4, 2009, 11:48 PM
Ok so i tried gcc -0 hello hello.c
and it makes a second file with no ext. what ext do i use to for the out put file? In windows it makes a exe file what does it make in the mac os?

It is not -0 (zero) it is -o (small letter o). There is no need for an extension for Mac OS X executables.