问题
I bought a pre-owned Macbook a little while ago and I've been coding inside Sublime Text 2 and compiling in Terminal with g++*. I wrote a stupid text adventure that I'd like to send to a friend and if possible, I'd like to know if there are any methods available on Mac of compiling to exe similar to the way I've been compiling my code (i.e. solely with terminal).
I understand that the easy solution would be to just compile the .cpp file on a Windows computer but my computer is all the way over at the other side of the room.
Thanks.
*Doing this due to being on Snow Leopard and being too tight to buy OSX Lion or an Apple developer license to access Xcode. If anyone has encountered the same problem then I found this solution on here ( https://github.com/kennethreitz/osx-gcc-installer and http://cims.clayton.edu/csci1301/how_to/compiling_c_on_a_mac.htm). Allows you circumvent the bullshit of Apple.
回答1:
Yes, it is possible and it's known as cross-compilation. Besides building your own toolchain for doing this, you can use MinGW: Cross compiling with MinGW
来源:https://stackoverflow.com/questions/11497983/is-it-possible-to-compile-c-code-to-exe-on-a-mac