2

GUI apps for Win/Linux/Mac in C/C++:

I want know how to write a "pure," "native," "API-level" apps for Windows, Linux, and Mac in C++.

I don't want "one-code run-anywhere", but native code for every OS.


Solution For Windows:

Just use Mingw/Win32 API; it's very simple and clear. That way I like programming under Windows.


Solution For Linux:

If I use, for example, wxWidgets-dev/GNU G++, my application can't run on PC/Linux if the user doesn't install wxWidgets? If not, how do I include the wxWidgets library in my program?


Solution For Mac:

Is Objective-C++/GNU G++ is the solution? Or is Carbon/C++/GNU G++ the solution?

Anonymous Penguin
  • 2,027
  • 4
  • 34
  • 49
Freeseif
  • 275
  • 1
  • 3
  • 14
  • Windows = easy, mac = difficult, linux = ? – Alexander Rafferty Oct 24 '10 at 20:44
  • No No No lool, Windows = very easy, Linux = easy, Mac = ? – Freeseif Oct 25 '10 at 00:16
  • If you find Linux development easy, you'll find Mac development easy. XCode is actually pretty good, and even if all else fails, just open a terminal and run `make` or `cmake` or whatever like you would in Linux. – Mike DeSimone Oct 25 '10 at 20:06
  • for me, its not about command line method, but is about programming language supported!, why i have one choice to develop a pure mac app ? is Objective-C !!! what about C++ ? and i found around the net comment say Objective-C++ is not a good way.. – Freeseif Oct 26 '10 at 00:00

1 Answers1

4

Mac

In the Mac case, you'll just want to fire up XCode and use Objective-C. Objective-C++ is mostly used to let you access existing C++ libraries from Objective-C.

Don't use Carbon, it's deprecated. It was only intended to make porting from Mac OS 9 easier.

Linux

This one is tough because there's really no guarantee of much of anything. You can be pretty sure that X Windows will be there, but there's a whole variety of libraries (Gnome, KDE, WxWidgets, FLTK, Motif, etc.) that may or may not be available.

In the old days, you could expect Athena widgets to be available, since they shipped with X Windows, but they look so crappy (somewhere between Mac OS 3 and Palm OS 1) that hardly anyone wants to use them any more.

So you pretty much have to pick a library/toolkit and use it, and expect your users to install it. Most distros make installation of dependencies really easy these days, so it's not as annoying as, say, installing wxWidgets on Windows.

Community
  • 1
  • 1
Mike DeSimone
  • 41,631
  • 10
  • 72
  • 96
  • 1
    It's true that there is no real "standard" library on Linux, but Qt and GTK+ are pretty safe bets, all major distros have them in their default desktop install. The others should not be a problem either, as all distros allow easy installation. – sleske Oct 24 '10 at 20:40
  • Mac: Objective-C/Cocoa. Linux: GTK+/C/C++. – Freeseif Oct 25 '10 at 00:17
  • Thank You Mike DeSimone and Sleske and Alexander Rafferty =) – Freeseif Oct 25 '10 at 00:18
  • 1
    Personally, I'd prefer Qt/KDE/C++ over Gtk+/C/C++. This is because 1) I prefer C++ over C, and 2) Gtk+'s manual object management is insane, while Qt uses C++ from the get-go. And, yes, I've written (albeit small) programs in both. If you really want to use Gtk+ with C++, I'd recommend using the gtkmm library (which is what I moved to early on for my Gtk+ programs, back when Miguel de Icaza was hawking Inti, before he decided to drop it and reimplement .NET). – Mike DeSimone Oct 25 '10 at 20:04
  • i tested yesterday GTKMM (http://www.gtkmm.org/en/), compiling helloworld gtkmm and run it on different linux distribution without installing gtkmm-dev package, Fedora, Debian, Ubuntu, and the HelloWorld app run without any error, but are you think QT is already installed in all major distribution ? – Freeseif Oct 25 '10 at 23:56
  • Qt is installed in anything that supports KDE. There's a version of Ubuntu known as Kubuntu that uses a KDE-based setup by default instead of a Gnome-based setup. Honestly, getting Qt installed for your users is easier than using a toolkit that doesn't do what you want, or makes you jump through extra hoops (e.g. custom widgets) and wastes your time. – Mike DeSimone Oct 26 '10 at 14:45
  • yes, you are right, but please i have one last question, whats the best and more easy for C++ apps, QT or GTKMM ? about your experience use ^_^ – Freeseif Oct 26 '10 at 20:24
  • 1
    Qt, barely. It wins because it uses a source preprocessor (`moc`) that handles some C++ "extensions" that Qt uses (such as signals). Gtkmm's approach is to handle signals in pure C++ with `libsigc++`, which is a bit harder to read. Look at example code for both and see which one you like better. – Mike DeSimone Oct 27 '10 at 11:39