Plain old C 'Hello World' under Xcode in 8 Steps
Imported from the Apple Support Forums via the Wayback Machine 🔗
1. Start Xcode, Developer>Applications>Xcode
2. In Xcode, choose File>'New Project' and choose 'Empty Project' as the project type. Then click 'Next', name your project, and click 'Finish'. An empty project will be created.
3. Create a source file. Choose File>'New File' and choose 'C and C++'>'C File' and click 'Next'. Name the file 'hello' and uncheck the 'Also create hello.h' box. Then click 'Finish'
4. 'hello.c' will be added to the Project. Replace all the generated code with:
/*
* hello.c
*/
#include "stdio.h"
int main()
{
printf("Hello world.n");
return 0;
}
5. File>Save, then choose Project>'New Target' and choose BSD>'Shell Tool', and click 'Next'. Name the Target 'hello' and click 'Finish'.
6. In the main Xcode windows, use the triangles in the left column to expand 'Targets' and 'hello' to reveal 'Compile Sources'. Then click on 'hello.c' in the left column. Now drag hello.c from the listing in the right column into 'Compile Sources'.
7. Select Run>Console from the menu bar, and then click on 'Build and Go'. 'Hello world.' should appear in the Console window.
8. That's it, now you are on your own!
2 replies
Sign in or join Beachball Help to reply.
- 0
- 0