1

I'm using Xcode to do the Project Euler problems in C++. I wanted to keep everything organized, so I decided to make a single project that would include all my .cpp files, like in visual studio. The problem that I am encountering is I have one project called "Project Euler" and then I wanted to have Problem1.ccp, Problem2.cpp, etc. enabling the ones I want to run. When I did that, I got an error "Apple Mach-O Linker Error". Does anyone know how I could do what I'm trying to do with Xcode?

1
  • 2
    Read the doc and learn how to manage multiple targets... Commented Nov 1, 2011 at 23:48

2 Answers 2

3

What you want is one Xcode target per problem (assuming that each problem has a main()).

To add a target to the current project (Xc4), go to File > New > New Target….

Sign up to request clarification or add additional context in comments.

Comments

3

Yes, you want to add a new Target using justin's steps.

You also need to understand what a target is: http://developer.apple.com/library/ios/#featuredarticles/XcodeConcepts/Concept-Targets.html

and how to run and compile the separate files: http://developer.apple.com/library/ios/#recipes/xcode_help-scheme_editor/Articles/SchemeBuild.html

To paraphrase, a target is a completely separate product contained in the same Xcode project.

When you want to change which target you're running/compiling/analyzing you need to adjust the scheme. In Xcode version 4.6.2 go to:

Product > Scheme > Desired Target

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.