Porting Windows C++ App to Mac

closed account (D49iE3v7)
Hello,
I would like to begin programming with C++ and have a project already made. The thing is I'm just beginning with C++ and don't know what to do with the current C++ app. It was made for Windows originally, and I'm trying to make it Mac-compatible. What do I need to do in order to do that?

Thanks,
Mason

P.S. Heads up, I'm an amateur with this stuff so please be nice :)
Last edited on
If it is just plain-vanilla C++ then the only thing you have to watch out for is file and directory names.

If it is a Windows GUI program, then you might have your work cut out for you.
closed account (D49iE3v7)
This is just a Windows GUI program. What steps do I need to take in order for it to be Mac-compatible?

Thanks for help,
Mason
Rewrite it.

Barring that, you can use Wine or install Windows on your Mac. Sorry.

[edit] If you used some sort of GUI library, like FLTK or GTK+ or the like, you can probably get away with just recompiling and fixing the few errors that pop up. But I can't be certain on what will happen.
Last edited on
closed account (D49iE3v7)
OK, first off, this application was already written. I'm just trying to make it work on Mac OS X. Are you saying I should do something in Windows to make it work on a Mac? Would compiling all of the resource files into a ".app" file work? If I only knew how to do that......

Thanks again,
Mason
Last edited on
No, I'm saying it is incompatible with a Mac (both the source code and the executable file). It only works on Windows.

The latest Macs use Intel hardware, so you can install the Windows operating system on your Mac, then run windows (and hence, windows programs) just fine.

Or, you can use Wine, which is a Windows emulator, which does pretty good in many cases. The Wine website has an extensive list of applications that it can handle.

Sorry.
Last edited on
closed account (D49iE3v7)
I understand that it is incompatible with Mac OS X as of now. But how do programs like Photoshop get programmed to work on both? This is not a shareware program. It's an updater tool for a Bluetooth car device (phone). It's nothing that fancy. If I send you the files and you take a look at 'em, do you think you may come up with a way for it to work on Mac OS X.
Last edited on
There are library sets such as Qt and GTK that have a common interface irrespective of which platform you're writing on. Both of these examples provide a common interface for Mac OSX, X Server and Microsoft. If you use one of them it can be cross compiled with very little effort.

If your code is using one of these then you should be OK, just look up the relevant sites for the howto's. On the other hand if your code makes the win32/MFC/DirectX etc calls directly you've lucked out.

Bertha
closed account (D49iE3v7)
Sorry for being a n00b, but how can I tell if the code makes the win32/MFC/DirectX etc calls directly?

Thanks,
Mason
I understand your frustration, but you aren't listening.

There are only two ways to make that program run on OS X: rewrite it or run it under OS Windows.

Since you say you can't do the first, you must do the second. Wine is an excellent package, and it is free. Check it out.
closed account (D49iE3v7)
See, the thing is, this app must work on Mac OS X. It's been a request by the company and I'm volunteering to do it as they need it. Thanks for your suggestions.
Last edited on
If you haven't got one of those third party toolsets installed on the PC you compile on, you're making the win32 calls and you'll have to rewrite.

Look up the calls its using to manipulate the GUI controls. Choose one and google it. You should be able to figure which API it belongs to. It's a guess but from your comments I'll be surprised if it is using a generic API and not win32.

Alternatively, follow Duoas's advice and suggest Wine to the company as a much cheaper (in manhours) option. Rewriting will not be a small/quick job.
Alas, mcmason, your application is fairly sophisticated in several important ways.

First, and most importantly, it is very tightly bound to the Win32 architecture.

Secondly, it uses Bluetooth, which is accessed slightly differently on OS X than Win32. (Though admittedly I know next to nothing about it.)

Thirdly, it uses multiple threads.

I am afraid that you have a lot of work ahead of you. You might want to tell your employer that the conversion is "not trivial and will require a near-complete rewrite" of the application.

As bnbertha noted, your employer will have to decide how much he wants to invest in making this work on the Mac. If it isn't that much, it would be worth looking into making Wine do it. (Wine has bluetooth support.)

If he does want to rewrite, one bonus would be that it could become trivial to make it work on Linux as well.

As an idea of what kind of mountain you'll need to climb, here is a site all about porting Win32 to OS X.
http://developer.apple.com/documentation/Porting/Conceptual/win32porting/win32porting.html

Here is a site about Linux GUI toolkits that work nicely under OS X.
http://developer.apple.com/unix/toolkits.html

Sorry the news isn't better.
Last edited on
closed account (D49iE3v7)
Duoas,
I really do appreciate the time you've spent trying to help me out. Wine seems to be the most practical way to do this, but I'll take a look at those links you posted.

Thanks again,
Mason

closed account (z05DSL3A)
ncmason,

I may be a little late for the party but you may also like to look at VMware Fusion.

Get the best of both the Mac and PC worlds with VMware Fusion. With an intuitive Mac-native interface and a wide array of powerful features, VMware Fusion provides the most seamless way to run Windows applications on your Mac.

http://www.vmware.com/products/fusion/
Last edited on
Topic archived. No new replies allowed.