Most traditional programming languages and most compiled applications incorporate dependencies on the host operating system, make various calls to the host operating system, and even use data structures and formats within the executable file itself that are host-specific; executables are generally not portable.
This is the case across Microsoft Windows, Linux, OS X, Unix, OpenVMS, HP-UX, Tru64 Unix, Solaris, *BSD, and most any other operating system around.
Most compilers — including C and C++, and Objective-C and Objective-C++ — do not generate portable executables.
There are sometimes translation tools available that can allow the code to invoke the expected host operating system features on another platform (that's not the target operating system platform), but I'm aware of no tool for this particular porting situation. An example of this approach is Wine, which allows some Windows executables to operate on Linux. Again, there's no tool available to do this from OS X to Microsoft Windows AFAIK.
Programming environments involving an interpreter such as Python, Lua, Java and Ruby — there are various other languages here, and the distinction between compiled and interpreter can be a little murky — generally can be packaged and transported and invoked on another target platform, so long as the dependencies are available on the target platform. OS X includes Python and Ruby, and Java and Lua are available.
Xcode can be used to maintain and build portable applications, but that's usually done with a command-line build or a build script (for Unix and Linux platforms), or using a tool such as make to sequence the compilation and linking. Xcode can invoke those scripts, but those are created manually, and Xcode needs to be told to call the particular scripts and not its default build procedures.
Porting and software portability are complex topics.