Reputation: 453
I am using Xcode to learn C. I made a project named Learn C, and I would like this to contain many exercises, like ex11.c, ex12.c, etc. However, this does not work, because all my exercises need the main function, but only main.c can have it.
In Eclipse, I would be able to make a workspace named Learn C, and have many .java files in it, like ex11.java, ex12.java, etc, to keep myself organized.
Does anyone know how I can recreate this in Xcode?
Thanks!
Upvotes: 0
Views: 347
Reputation: 66194
Start by creating a workspace:
Once you have that you can create new projects within the new workspace. To do this...
This should create a new project in the Learn C workspace. You can repeat the project-creation steps above (not the workspace creation; you already have one of those) for as many projects as you want, so long as their names are unique. Once you get the hang of this, you will be able to share code between projects using the advanced capabilities of the workspace and project management features, but for now this should be enough to get you going.
More information can be found on the Apple Xcode Developer Website (assuming you've shelled out your $99 annual developer fee). There is a wealth of info on Xcode, and though it (imho) isn't as snazzy as the likes of Visual Studio on Windows, it becomes natural after some time (like all things). The section titled Maintain Your Code and Other Resources in Projects or Workspaces will probably lead you further down the path you're interested in pursuing.
Best of luck.
Upvotes: 0
Reputation: 26355
You can do this in Xcode as well. For each exercise, you need to create a new target. To do that, open your Xcode project, click on the Project Navigator tab, and select the project. Then, from the "Editor" menu, select "Add Target". If you're working with examples from a book or web page that isn't Mac-specific (or iOS-specific), you'll want to select "Command Line Tool" as the type of target. Xcode will create the new target and you can add your new ex*.c file to it.
Upvotes: 1