Different programs in the same Xcode C++ project
In order to compile multiple separate files (separate binaries as a result) You would need to create separate targets for every file.

To add new target please choose: File -> New -> Target.., select for example Command Line Tool. Make sure it's properly added to Your project. Here's example:


My main.cpp is added to target multiple_targets like this:


My main-kopia.cpp file is added to target2 like this:


to be sure check the build phases for every target, here's example of my target2 Build Phase:


With this I am able to compile both main.cpp and main-kopia.cpp. Notice that they both have main() inside them.