tags:

views:

476

answers:

11

Hi , I am nearly done with a course about using OOP in C++ and all the programs we wrote in that course were console applications . I also finished a university course in C programming so I think I have solid C programming basics and now is the time to make a big step towards GUI .

I did a lot of googling and each time I read more pages I get more confused , I learned that there were too famous options in the past which are WinAPI and MFC. I tried to look into the WinAPI but It seems pretty tough and needs a lot of time so I asked my instructor's advice and he told me that If I wanna write GUI programs I would better learn C# or Java rather than using C++ which is faster but better designed for low level programming applications like drivers and so . So I searched the web to find if C++ is still used in writing nowadays applications and to my surprise Firefox, Google Chrome, Notepad++ and many other GUI applications on sourceforge.net are written in C++ in contradiction with my instructor's advice. Also I learned that you can use QT or GTK libraries to build GUI applications in C++ but I have no idea ow to do that or if that is true.

So My question is what are the nowadays best available options to write GUI programs efficiently no matter how steep is the learning curve. I googled for C++ GUI options because It think it will be faster than Java or C# apps, If anyone has a different opinion state it please.

+1  A: 

It depends on what kind of GUI application you want to write. If you want to write a shrink-wrapped app like MS Word or Firefox, then C++ is the way to go, because the market demands the last little bit of performance, with minimal dependencies. OTOH, if you want to write (for example) an interface to your company's database, the performance of the GUI is normally not important, but delivering something quickly and cheaply is, so you should use something more RAD, like C#.

anon
+1  A: 

Qt is very good. People say WTL is also nice, but I didn't used it.

Java and GUI does not fit very well in my head. There are some native to Java GUI libraries (AWT, Swing) but they are slow and don't provide interface native to platform it runs on. There is also SWT, which is used by Eclipse, but haven't seen any app besides Eclipse using it.

If GUI needs are simple I'd stick to C#: you drop some controls on your form, write some logics behind it and you are ready to go. If you need some really complex GUI then I don't think there would be a huge difference in development time between different languages.

n0rd
So Qt is just a library that eases making GUI applications under C++ ? Can you give an example for applications that uses Qt ?
Ahmed
Have to admit that Java is not great at building desktop applications. Stick with C# if you want a rapid development environment.
Truong Ha
Qt is not only about GUI. It is a framework that allows making crossplatform applications (it has a lot of utility classes not related to GUI). As for examples: Qt Creator - a IDE for Qt development is written using Qt.
n0rd
In C++ nearly everything is "just a library". MFC is also just a library, with the notable difference to Qt, that its desing is #}]* ... - ahm, make that - dated, comes with Windows and is Windows only.Qt is cross platform, and it also comes with QtDesigner, which integrates into Visual Studio, and lets you do Point and Click Design.For [applications that use it](http://qt.nokia.com/qt-in-use/target/desktop), Skype, Google Earth, Adobe Photoshop Album, and of course [KDE](http://www.kde.org)
Fabio Fracassi
SWT is quite nice and would probably be a good point to start. As eclipse shows, you can create amazing guis there.
atamanroman
A: 

If you decide for C++, have a look at wxwidgets - this way you don't limit yourself to just one operating system (windows in this case with MFC). Also QT should be good, but I've never tried them (I do not have much experience with wxwidgets either, but the few times I had to do something with them, they worked pretty well).

If you don't need high performance in the gui, have a look at scripting languages - Python has a default library that works well (tkinter) and also binding to wxwidgets

Nicola Montecchio
+2  A: 

The fastest way is to use C# and WPF. It's fast and simple for small applications but can be pretty complex in my opinion and there is a lot to learn. At least you are future proof, Microsoft is pushing WPF themselves finally. (Visual Studio uses it, and there will be a lot more versions to come) The only real downside is, that you will only be able to run the application in Windows.

If you really want the "low level" access, there a lot of interop options with C++ code.

Blub
Will C# and WPF perform as well as C++ and MFC for example ? As Long as you are saying they are hard to learn then why shouldn't I learn what's faster .
Ahmed
"The fastest way" here is only the time to developer your applications. I believe that those applications can use computer resource as well as run as fast as application written in C++ and WinAPI. That's why Firefox, Chrome, and many other famous applications still use C++.
Truong Ha
That doesn't make sense . You are saying that C# is faster in developing and as fast as C++ and WinAPI in program response and efficiency , Though people use C++
Ahmed
@Ahmed Generally people say that C++ CAN be 10% faster, but you have to be a pretty good C++ expert to experience (or even need) that kind of small performance boost. C# will cut your development time, and performance should be more than enough for pretty much any application except bleeding edge scientific research or games.
Blub
That sounds good for my needs , though Qt has been voted for as a better answer but I guess that on my current level of knowledge I should be starting to learn GUI the easier way which is C# and when I reach a higher level of mastering several languages it will be easy for me to tackle Qt then MFC . Thanks Bulb .
Ahmed
-1 "The fastest way is to use C# and WPF."
Artyom
Blub
@Blub, have you used Qt4? It is very easy to work with, another point "fast" is misleading. The author asked about performance, and especially not about "learning curve" so fast in your answer can be easily misinterpreted as performance.
Artyom
@Arty Actually the author asked for efficiency. I really don't think my answer can be misinterpreted, it clearly states that USING c# is the fastest way, and I even state that its fast for -simple, small- applications. Please reread. I just tried Qt very briefly, and found the designer to be above average, but didn't want to extensively read docs just to get to the part where I can actually code with that stuff.
Blub
Chill out , I found both your answers useful and I decided that Qt is better but needs a higher level of a programmer so I will just hop in GUI world using C# which will be fairly easy and efficient and after writing a few GUI Apps I will try Qt .
Ahmed
+17  A: 

First of all, if you want to lean to write platform independent GUI then C# is no go.

When you write GUI in C++ there is a question of toolkit, Qt and GTKmm provide you very solid cross platform toolkits while Qt have more "native" look and feel on Windows then GTKmm.

Java Swing allows you to write very good GUI as well but it would be heavier and slower then one written with Qt or GTKmm.

Now... C#/WPF same issues as Java GUI - slower then native, but also it also locks you on one platform only.

My personal advice start from Qt.

Artyom
I never quite figured out when you have to buy a Qt license and when not. I think you are good to go when you only develop for the desktop, but please don't take my word for it.
Blub
@Blub, recent Qt version released under LGPL, so you can use it almost without limits as long as you link with it dynamically.
Artyom
I heard you can use mono.
Johannes Schaub - litb
+1  A: 

C++ is good for speed (HTML rendering tools like chrome / firefox or image editors like photoshop) and for performing "feats" you might not otherwise be able to do on other platforms.

But it is more painful to use and there is much more of a luearning curve on any of the C++ based UI libraries than you would care to learn.

Since you do not seem to require any of this, as is clear from your question, your default choice should be C# or Java or Web based like your tutor advised.

I sort-of disagree. Qt (for instance) is VERY well documented and I have had only a few "gotchyas" since starting with it about a year ago. The real struggle for a beginner will be the language, not the framework. On the other hand C# is a slightly simpler language to pick up, but I find MSDN documentation sloppy and difficult to learn from.
San Jacinto
QT could be a special case - i wouldnt know as i haven't used it. But why trouble with C++ and memory management when obvioulsy the user simply needs some tool to build a UI. The OP does not even have a specific UI use case, let alone a specific C++ use case.
@computinglife the Qt memory-management model is pretty neat. If you inherit from an object in the framework and set its parent to another object in the framework, you'll rarely need to manage memory on your own. For the cases when you do, there are smart pointer classes. There are very good reasons to use Qt and very good reasons not to use Qt. I'm just saying that despite the language, it's a great framework.
San Jacinto
A: 

If you insist on using C++, try Win32 or GTK. See this thread. Otherwise I recommend you try another language such as Python for the GUI part of your applications: Keep the rest in your preferred language and wrap. Do not forget the best feature of C++: binary compatibility with C.

Matt Joiner
Interesting thread .
Ahmed
A: 

Try Juce.

SKINDER
+3  A: 

If you are new to GUI programming C#/WinForms will be best for you. It rather simple, have a great community around it, have a lot of ready-to-use controls.. and best documentation ever - MSDN.

Sure, if you are looking for deep knowledge of "how things works" you then have to understand Win32 GUI. So, you can always back to C++/MFC for that. I would not suggest any other C++ libraries (as Qt), not because they are bad, but because they require good experience to start up.

My suggestion is start with WinForms, undestand the basic and learn to create simple application. As soon as you are master in that, go deeper :)

alexanderb
Totally agree with you. I've been working with .Net forms before writing my first application in C++ using only Win32 API. It was such a painful time since everything was strange and difficult to understand.
Truong Ha
I remember my times than I switched from Borland C++ Builder, to Visual Studio MFC.. of god :)
alexanderb
+1  A: 

C++ never dies, so that learning it is not a wrong decision. However, it is quite difficult to write GUI applications using C++ during early days. Therefore, I suggest you to use C# t write some GUI applications before switching back to C++.

Truong Ha
A: 

If you have c++ foundation and want to expand that I recommend to start from Qt. It's distribution includes graphical UI designer and Asistant - browser for documentation. There is also separate product Qt Creator - complete IDE tailored for Qt which have everything integrated (including compiler). All of this if free and really easy to setup. Excellent tutorials included. Qt also includes non gui classes for common programming problems (like containers, variant type, etc.). You can convert your console application to GUI in a matter of few hours and decide if you want to continue learn it or try some other toolkit.

Just go to http://qt.nokia.com/downloads download SDK, install it and you have everyting to start coding.

Bazurbat