So the thing is that we're using Macs on a class, but I only have a Windows PC, and my assignments need to run on these Macs...
Is there any windows compiler or something that lets me run my C++ programs on Mac?
So the thing is that we're using Macs on a class, but I only have a Windows PC, and my assignments need to run on these Macs...
Is there any windows compiler or something that lets me run my C++ programs on Mac?
I had posed the same question to a programmer friend of mine when I was thinking about making some apps for the iphone/ipod ect. He suggested downloading a VM and setting up a compiler in it. I'm sure there are drawbacks to this as I'm not very knowledgable on the subject, but it could at least get the ball rolling for you.
Virtual machine - Wikipedia, the free encyclopedia
Though I'm sure one the the senior programmers here has a better solution.
Last edited by Lesshardtofind; 09-18-2010 at 01:35 PM.
Make sure you write portable code. Also, try to use the maximum warning settings in your compiler, so that your teacher's compiler doesn't spit out errors that you could've prevented.
This implies that you DO NOT, under any circumstance, use OS specific APIs.
Edit: Of course, you can use OS specific APIs if you #ifdef a valid alternative, but for simple things the standard should be good enough for you.
Last edited by Jorl17; 09-18-2010 at 02:57 PM.
yeah, the problem is that I don't own a mac though, so I can't compile the mac version of my code
Unix operating systems can use Wine, a program that can execute Windows and MS-DOS binaries, as long as they use a command-line interface or a simple GUI.
WineHQ - Run Windows applications on Linux, BSD, Solaris and Mac OS X
Then follow my logic: Write portable code. If it's portable and fully standards compliant, it __HAS__ to compile. If it doesn't, then it's the implementation/compiler's fault and you should not be penalized.
You just have to make sure that you do it. Alternatively, as suggested, you can compile Windows binaries and ask your teacher to use Wine with it. I hang around Wine's forum a lot and I can tell you that it is really good.
But stick with portable and standards compliant code. Don't fall into common pitfalls such as defining arrays with non-const size_t's and the like...
And, to make sure that it is compliant, enable maximum conformance / warnings in your compiler.
Are you expected to turn in program source code or compiled executables? If you only need to turn in the source code then simply write portable (i.e. conforming strictly to the language standard and avoiding platform-specific APIs) programs, as Jorl has already said.