Saving C++ Program For Mac?

Jun 25, 2018 at 12:47am
Hi, I use a windows computer. What I'm trying to do is write a program on here and save it so it can be used on a Mac. I've looked around, I couldn't find anything useful, at least nothing I could understand. The configuration types on C++ is .exe / lib/ dll / utitlity(?). I don't really use Macs and am pretty clueless in this topic. I don't need to compile or code on the Mac. All I need is for this code (Mac compatible) to be saved as something that can run on a Mac rather than as an executable. Thanks!
Jun 25, 2018 at 8:57am
If you create an app on Windows and compile it it will run only on Windows.
If you want to run it on a Mac you need to copy your .h and .cpp files to the Mac and compile it again - it will work only if you use only standard C++ and nothing Window specific.

If you want to run programs on other platforms without recompiling you can use Java
Jun 25, 2018 at 4:38pm
I see, thanks Thomas1965. I thought there might be a more convenient way, but I suppose not. Perhaps I will just use Java for this. Thanks again!
Jun 25, 2018 at 8:10pm
Cross-compiling from Windows to Mac OS is probably possible, but I can't find any straightforward method from searching. It is easier to cross-compiler from Linux to Mac OS. You could use Java, but you could also explore getting a Virtual Machine, such as VirtualBox or VMWare, find and install a Mac OS X image, and set up a C++ compiler environment on there.
Jun 25, 2018 at 8:21pm
closed account (E0p9LyTq)
There are Windows emulators for Mac that theoretically allow for running even Windows specific programs on a Mac.

http://www.macping.com/top-10-windows-emulator-for-mac-that-will-allow-convenient-access-of-windows-applications-on-your-mac/

The best and most reliable way is what others have said, compile source code for each OS.
Jun 26, 2018 at 4:48am
Thanks guys for the new responses. In my particular situation, it would easiest to do it on Java. Thanks again everyone!
Topic archived. No new replies allowed.