Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

dieseltwitch

macrumors regular
Original poster
Jan 24, 2008
142
0
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

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
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

macrumors regular
Original poster
Jan 24, 2008
142
0
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 =
 

dieseltwitch

macrumors regular
Original poster
Jan 24, 2008
142
0
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?
 

dieseltwitch

macrumors regular
Original poster
Jan 24, 2008
142
0
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 .........."
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.