Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Ok I know I am probably opening a can of worms here but, it should be fun...
I am a lapsed C programmer, (its been 15 years...) and I am wanting to get back into it again. I have never programmed a GUI before and if I am going to be getting into it again, I may as well do the whole hog and go GUI.
So I need all of your collective experiences to help me filter the bucketloads of stuff out there.
Do I stick with C, or go to C++
Any documentation for the transition?
Programming in GUI, I guess X windows, seeing as how I am using Linux at the moment. Books? Docs? Tutorials?
Your favourite IDE? Never used one before, programming for me was VI or maybe JED if I was feeling lazy... and associated documentation?
I am really only aiming at some simple front ends for a few of my research projects which, as you all know will no doubt turn into something else entirely!
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
I would think that the C - C++ choice is a six-of-one, half-dozen-of-the-other (I prefer C, but I'm old and crotchety so there you are). C++ is all about "objects" and, if you can wrap your head around objects and try your best to create objects that are actually useful across applications, well, then you're ahead of the game; problem is, if you create C libraries that are useful across applications you've pretty much done the same thing without all the fooling around. Now, that's a little harsh (and probably just waves a wand over the surface) but my experience with C++ is a whole lot more typing that I want to do just to get "Hello, world" to compile and run.
A potential bonus for learning C++? Java is just C++ without structures and pointers (ooh, that'll raise some hackles!), so if you learn C++ and you're halfway there with Java.
Either way, the QT libraries are quite handy for creating GUI user interfaces -- QT tutorials? Well, I dunno which (if any) are good, bad or indifferent. The X libraries have been around for a long, long time and X is effective but is thus limited to X; QT is kidna-sorta cross-platform and worth a look. You may want to consider front-ending with HTML and PHP if you want a universal user interface (and it's a lot easier than actually "programming" a GUI); everybody's got a browser, not everybody's got X or QT, eh?
IDE. The only one I've used is NetBeans and, frankly, I found the learning curve far steeper than I wanted to deal with (I write code a whole lot faster with vi than I've ever been able to do in an IDE). The IDEs are large beasts, complicated to learn and use and really don't fit my way of working; best to download one or two, see if there's a fit with your head and go from there. This is not to say there's anything wrong with an IDE, on the contrary they can be quite useful in development shop where there are different skill levels and assignments across a group of folks working on an application or group of applications. It's a different way of thinking.
You could, if you're old-fashioned enough, use curses (ncurses). Simple, been around forever, works just fine with any terminal emulator.
As for tutorials I'd take a look at any of the books written by Steven Kochan and Patrick Wood -- they're oldies but goodies, well-written with working examples that shed a great deal of light on otherwise potentially confusing means and methods. Your local library, Amazon, E-Bay, etc.
I agree wholeheartedly with what tronayne said (though I'm rather young and non-crotchety, so I fall on the C++ side of the fence - just).
If you're going with IDEs, the only one I could really recommend is Code::Blocks, but vi + makefiles + gdb has always worked well for me. I find IDEs a bit too... I dunno, pushy. Trying to make me do things their way, rather than my way. But I guess it's just a matter of playing around until you find one that works for you
I also would repeat the recommendation of using ncurses, especially if you're prototyping your displays. I tend to find if I go straight to GUI I get sidetracked ("OOH! Sliders! Menus! Pretty things!") and forget that at the end of the day I'm making an application with is meant to work. So nowadays I write a simple curses frontend (this also means you separate the functional side of your code from the graphics side of your code) with lots of weird and wonderful key combinations to get it to do everything, and then port that into a more flashy and "intuitive" interface if I feel that it requires it.
If you want to make GUI apps with buttons, menus, etc., do not use X11 directly. It has no such concepts, it's just a way to draw on the screen. Use Qt or GTK+ instead.
Personally I recommand Qt over GTK+. And even thought I'm not a big fan of C++, in my opinion it's still a far better choice than C for GUI programming because it has objects. GUIs are so inherently object-based that GTK+ actually had to create its own complicated way to retrofit objects into C, and in my opinion this is unnecessary complication that could have been avoided by simply using C++ (like Qt does).
Thanks guys, this is great! It is really easy to get overwhelmed by the sheer quantity of info out "there" nowadays. Back in the day if you typed LINUX or PROGRAMMING into a search engine it seemed all you got back were more calls for help from other people. (I had a 28.8 modem back then, recently upgraded from a 14.4 with my $2500 pentium 120...mmmmmmmm homer-esque drooling noises...) Now, well its just unbelievable.
Its pretty gratifying to hear a few things that I had already heard of/ looked at come up. I have NCURSES on my TOPRINT/TOREAD/TODO list and I had grazed speculatively over GTK+ with sounds of GUI longing in my voice. But a real look at what I want to do brings me back to NCURSES and C. I dont want to spend my very limited programming time learning an IDE or a whole lot of widgets that I'll likely never use. Having said that I know that I'll probably end up dabbling with something like GTK+. BTW what does Qt stand for? Cutie? Lests assume that its not QuickTime. Lol...