9

I work in a team of developers, one of us works specifically under Windows, and I work primarily in Mac OS X. We're wanting to develop C-based applications either in C++ or Objective-C however I'm not really knowledgeable in how to go about a cross-platform development project.

Is it viable to work in C++ using Mac OS X? Obviously they're geared towards Objective-C but is there just as much support for C++. What about cross-platform development in these languages? I'd use something like boost and some kind of UI library.

Has anyone got any experience in developing for multiple platforms yet allow applications to run natively without the need for a VM?

EDIT: There's a lot of answers I want to mark as correct now. It seems like Qt is the way to go and develop it in C++. Chances are this will be for *nix, OS X and Windows so that would be the best option for us personally. If I can avoid writing Objective-C so the team sticks to C++ then all the better. If I have to write the GUI in Objective-C and mix and match then that's not too much bother either.

asked May 14, 2009 at 13:09

5 Answers 5

13

I work for a software company that produces software for Mac OS X and Windows using C++, MFC, and Objective-C.

Yes, it is definitely possible.

You probably will be best served if you develop the "core" of the application in C++. In a MVC application, the C++ part would be the model, and possibly the controllers. For the code that interfaces to the GUI and other OS-specific interfaces, you should use the native APIs: Objective-C on Mac OS X and C# on Windows XP.

The good thing about the Mac is that you can compile C++ and Objective-C together. You can even have Objective-C++ where C++ and Objective-C are compiled in the same compilation unit. Unfortunately you cannot do this with C# (there is something called Managed C++ which is a different beast).

I would avoid cross-platform frameworks such as Qt and wxWidgets. They both allow you to develop cross-platform applications, but the look and feel of such applications is sub-par. I have more familiarity with wxWidgets though, its design is heavily geared towards the Windows MFC paradigm of application design.

Edit May 14, 2009, 9:44 AM EST: If Qt now allows true look and feel of the native platform, it could be a good option. I haven't looked at the latest offering so you may want to look at that framework before designing your own. That decision should be made after examining the results of the applications and how comfortable you are with the design paradigms that Qt requires.

answered May 14, 2009 at 13:21
Sign up to request clarification or add additional context in comments.

5 Comments

Actually, Qt can now integrate with Cocoa, so the look and feel could be absolutely the same.
We're basically on the same page ;-)
If the rest of the app is in C++, I would definitely pick MFC over C# for the UI.
Isnt' MFC old-school? I know we've had to do a lot of extra work to make our Windows side look modern (we use MFC). Isn't WPF the preferred GUI technology?
There's no question that you need to do more work in MFC than C#. But there's also an extra burden when mixing managed and unmanaged code. If I were going to use WPF with a mostly unmanaged C++ app, I'd definitely want someone on the team with that kind of experience.
9

You could look at Qt. I've used it successfully on Windows, Linux and Mac OSX projects.

answered May 14, 2009 at 13:16

3 Comments

This is probably the simplest post yet makes most sense :)
You failed to mention licensing issues. Qt is fabulous and a very clever framework but you need to think about other aspects: you want to be locked in? pay a fortune if you do not want to expose your source code?, etc etc.
The Qt license isn't particularly onerous. It's largely LGPL which you can use with pretty much any project you want, open source or proprietary. The only case you need to pay them for is if you are modifying Qt itself and redistributing or you are embedding on a device.
4

what I use, is have a common library written in C or C++ with all the core functionality of your application.

Let's say you are building a solitaire game. So you will have core classes in a pure C++ (mostly platform independent) library.

  • CoreSolitaire

Then, you will have separate UI projects, one for each platform you want to deploy your solitaire on:

  • iSolitaire (Objective-C, MultiTouch Cocoa Based for iPhoneOS)
  • MacSolitaire (Objective-C, Cocoa Based for Mac OS X)
  • WinSolitaire (C++, Win32 or C# Based for Windows plaforms)
  • GSolitaire (C++, GNome/GTK based for linux/unix)

It's more work, but, in my opinion, the resulting product is definitely better than one you could get by using a platform independent widget set like QT or wxWidgets.

Having said this, if you are going to deploy your product internally in a company where you have full control of the deployment environment, and you don't care that much about how the resulting product will behave on different platforms, you could definitely use a common API for everything (QT, wxWidgets, or any other you might encounter).

answered May 14, 2009 at 13:25

1 Comment

Actually, QT looks absolutely native in Windows and Linux (KDE or GNOME theme support). And with Cocoa-QT integration, you can use QT and have a Cocoa GUI for Mac too, with a little more work. Beats using 3 different UI toolkits.
1

Is it viable to work in C++ using Mac OS X? Obviously they're geared towards Objective-C but is there just as much support for C++.

Yes, there is.

You can do pretty much anything you want with C++ in OS X --anything that you could do with C++ on Linux, for example. There is support for the gcc's C++ compiler, c++ libraries, et all. Xcode provides support for working with C++.

You can even mix c++ with objective-C with Objective-C++ (Note, however, that this is not portable for GUI work).

What about cross-platform development in these languages? I'd use something like boost and some kind of UI library.

I believe that your best bet is QT.

It is a stable C++ library that is cross-platform (Windows, OSX, Linux and more), has been around for over a decade, is well supported, with many commercial apps written in it (Skype, Adobe Photoshop Album) and a ton of open source stuff written with it (the KDE desktop for starters). Besides GUI stuff it provides a whole lot more (container classes, xml, database connectivity, etc).

You can develop both Open Source and proprietary (closed source) apps for free with the latest QT, and the library was recently bought by NOKIA, a huge multinational, so it isn't going away any time soon.

Besides the library, QT also comes with an IDE and a Visual Forms Designer (all for free).

Other cross-platform GUI libraries for C++ also exist for OS X (wxWidgets, gtkmm, et al).

answered May 14, 2009 at 13:19

1 Comment

wxWidget on Mac OS X manages to do simple GUIs with buttons and fields pretty well, but a full-featured application will feel very non-Maccish with wxWidgets. The font dialog is an example.
0

Has anyone got any experience in developing for multiple platforms yet allow applications to run natively without the need for a VM?

Slightly. Make sure that you wrap around all the platform specific code. That way you're main application or library doesn't need to reference the platform specific code. That should make it alot easier when porting to another platform.

answered May 14, 2009 at 13:29

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.