How to Compile a .C File in Xcode 4
Why are the "Run", "Build", "Debug" options greyed out when I have a .C file open? Why can't I compile a .C file in Xcode 4?
iMac, Mac OS X (10.7.5)
Why are the "Run", "Build", "Debug" options greyed out when I have a .C file open? Why can't I compile a .C file in Xcode 4?
iMac, Mac OS X (10.7.5)
You should create a new command line project, then add your c file to the project (removing the c file that the project already has), then compile.
To create a new project select the menu item "File > New > Project...":
Now select the "Command Line Tool":
Follow the prompt to enter the name of the project, then where to store the project. When you have completed, click the file main.c and you should see a window like:
I suggest compiling and running this first. To run the program select the menu item "Product > Run". XCode will compile, link, then run the program. You see the output window appear like:
Once you have done this. you can replace the main.c file with your own OR replace the contents of this main.c file with the contents of your file by copy and paste.
How to Compile a .C File in Xcode 4