Is it possible to compile C++ code to .exe on a Mac? [closed]

落爺英雄遲暮 提交于 2019-12-22 10:52:53

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!