Question:
Can I code a program for windows on a Mac and vice versa?
George
2012-06-24 04:54:03 UTC
Im learning java and soon when I get more used to coding I'm going to move onto c++ so if I code on a Mac a program in those languages could I get them to work on windows to? If it's yes I'm definitely getting mac please help only if u no what you're talking about
Three answers:
t
2012-06-24 05:30:50 UTC
Java: Yes. Java is completely cross platform - you can run your .class and .jar files on any machine that has Java. The same .jar file will run on both Windows and OS X.



C++: Sort of. The binary you get when compiling on one machine definitely won't run on the other (e.g. if you compile on Windows you'll get progname.exe which won't run on your Mac). However, if you stick to the Standard Library and don't use any environment-specific features, you should be able to compile your code on both machines. So for example you can't use "conio.h" and you should avoid using system() calls. Usage example: write code in a .cpp file on the Mac. Compile it to get a.out which you can run on the Mac. Copy the source code (.cpp file) to your Windows machine, compile, and get progname.exe which you can run on Windows. You could also use a cross compiler to compile the Windows executable on your Mac, but that's probably too complicated for your purpose.
2012-06-24 11:58:41 UTC
i am unable to answer this though can let me know if find out for sure as i wondered about his too and have you considered further? I can run a virtual mac on windows with good ram and processor so quite interested to know, i would expect you can seeing as can run a vm :)
kylan
2012-06-24 12:00:19 UTC
you should be able to you wouldnt be able to test it without an emulator but using a text editor you should be able to code ot


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...