Search code examples
c++xcodexcode4

Multiple .cpp programs in xcode project?


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?


Solution

  • 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….