问题
Obviously you can't really run Mac or Linux apps on Windows, but can you compile binaries for those platforms using MSVC++ for example (plugging in additional compilers and tools obviously)? For a serious build system, you don't want one build server per platform so having an automated build server which compiles for all target platforms seems quite a reasonable aim.
回答1:
Crosstool-NG seems like your best option for Linux apps; they show that as one of the standard configurations. I do not know about Mac OS X; this question suggests that it will probably be difficult.
回答2:
I would like to believe (notice my careful words) that GCC can be built to run on windows (any relevant form of the triplet --mingw*) and target another triplet.
A proof-of-concept for the non-believers is provided here, where you can find Win64 hosted compilers that build native linux binaries. I assume the same can be done for mac if the necessary libraries (like the CRT and necessary Mac framework libraries) can be built/used by that compiler.
回答3:
if you want to build applications using C++
, why not use Qt
from Nokia. it's cross platform. http://qt.nokia.com/
来源:https://stackoverflow.com/questions/4984609/compiling-for-mac-linux-on-windows