views:

53

answers:

1

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

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

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

Solution For Windows

Just use Mingw/Win32 API, its very simple!, very clear, and 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 other PC/Linux if there don't install wxWidgets ?! if else, how to include wxWidgets library in my EXE ?

------------------------

Solution For Mac

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

+4  A: 

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.

Mike DeSimone
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
Mac: Objective-C/Cocoa. Linux: GTK+/C/C++.
Freeseif
Thank You Mike DeSimone and Sleske and Alexander Rafferty =)
Freeseif
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
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
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
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
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