LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-03-2008, 09:15 AM   #1
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Rep: Reputation: 164Reputation: 164
Interested in Beginning X Programming


I'm seasoned in Visual Basic, and BASIC before that.

Now I'm using Linux, and would like to begin programming in it. I don't necessarily want to limit myself to GNOME or KDE development, but would like to begin development in an object oriented environment. C is the language I would like to learn.

What X development applications would you recommend?
 
Old 06-03-2008, 09:36 AM   #2
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
From what I've heard over the years, programming with xlib (The X11 GUI library) is frightening.

If you're looking into learning non-GNOME-KDE, object-oriented GUI programming (and want to stay away from Java), try the WxWidgets toolkit; it's written in C++, but has interfaces for other languages, like Python (and others).
 
Old 06-03-2008, 10:29 AM   #3
snowtigger
Member
 
Registered: Mar 2005
Location: england
Distribution: slackware, win2k
Posts: 364

Rep: Reputation: 35
ummmm.....

as far as i'm aware you can still go down the GTK route without depending on Gnome.

 
Old 06-03-2008, 11:08 AM   #4
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
@snowtigger: Yes, GTK+ programming doesn't depend on GNOME in the least. However, if "object-oriented" is the key phrase here, C programming won't cut it.*
You can use the gtkmm package for programming GTK+ apps with C++ though.

* To anyone thinking of doing so: Do not try and start going down the "well, theoretically, you /can/ do object-oriented programming with C..." path. While I don't agree with the ideology of how C++ and Java are considered object-oriented programming languages, this isn't a place to start a flame-war over who is more correct.
 
Old 06-03-2008, 11:15 AM   #5
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
Quote:
From what I've heard over the years, programming with xlib (The X11 GUI library) is frightening.
well, xlib is, but mostly one would us the X toolkit and Motif which are very similar to program as GTK. (i.e. tricky).
Though there's no nice interface builder like glade that I know of
apart from dtbuilder and xdesigner which come on solaris 10 but the source won't migrate
easily if built from them.


Quote:
Originally Posted by snowtigger View Post
ummmm.....

as far as i'm aware you can still go down the GTK route without depending on Gnome.

yes you can. with the advantage you can use Glade to build the GUI.
I use Perl GTK on freebsd and I don't got gnome.

though if you aren't used to C or linux, you might find jumping straight in to
X programming a bit scary.

what about gambas? that's a VB clone I hear.

the documentation is not great either for GTK (IMHO) you may need to get
used to scouring include files.
(I swear quite a lot)

you may find koders a good resource when you get stuck
on whatever you are doing.
 
Old 06-03-2008, 11:48 AM   #6
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
I've fiddled around with Gambas a fair bit in the past, but I feel the need to stipulate several things: #1 it is not a clone, #2 it is not quite VB. Gambas is its own type of BASIC; I tried using it when I first started trying to program under Linux (as when I switched I was practically fluent in BASIC), but it quickly left me in the dust and has far too many little quirks.

If you're familiar with VB.NET programming, I would heavily recommend looking into the Mono Project and compiling/installing the "mono-basic" package, with MonoDevelop as an IDE.
 
Old 06-03-2008, 12:35 PM   #7
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Original Poster
Rep: Reputation: 164Reputation: 164
Needing some clarification ...
As I understand it, I can write applications specifically for Gnome, or KDE exclusively. But if I want to be able to write programs that will work in either, I need to use GTK? It seems that some programs written for KDE will work in Gnome, and vice-versa.

I'm not particularly interested in cloning my knowledge in .NET. I'm ready to teach myself C. I'm not so sure Mono is what I'm looking for.

Last edited by SlowCoder; 06-03-2008 at 12:36 PM.
 
Old 06-03-2008, 02:13 PM   #8
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
Okay. Good to know. Here's some clarification:

KDE uses the Qt graphical tookit, where GNOME uses GTK+. When it is said you develop an application for KDE or GNOME, it means you are using the environment's "native" toolkit, and you're also using libraries for interfacing with the environments (libgnome, or libkde); you will make use of a language's "bindings" to those environments. Essentially, these bindings aid with IPC (interprocess communications) between applications, and essentially provide a small framework for defining particular parts of the program to be accessible from within other programs (think along the lines of CORBA and HAL with DBUS).

You can build applications using the Qt and GTK+ toolkits that do not tie themselves into a particular desktop environment (KDE and GNOME respectively); all that is required of the user is to have those libraries (libqt, and libgtk) present for when the user goes to compile or install your program.

Not to try and complicate things, but there are other toolkits out there as well, that aren't as widely used (in the Linux/UNIX world), like WxWidgets, and ETK to name two.
 
Old 06-03-2008, 02:33 PM   #9
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Original Poster
Rep: Reputation: 164Reputation: 164
Quote:
Originally Posted by indienick View Post
You can build applications using the Qt and GTK+ toolkits that do not tie themselves into a particular desktop environment (KDE and GNOME respectively); all that is required of the user is to have those libraries (libqt, and libgtk) present for when the user goes to compile or install your program.
So, what you're saying here is that I can choose to use either the Qt or GTK+ toolkits for development, and that doesn't mean my application is tied to either Gnome or KDE, as long as I provide both libraries?

I understand that C++ is backwards compatible with C. Any reason I should try to learn C before C++?

I'm looking to purchase the following book: http://search.barnesandnoble.com/C-P...6004965/?itm=1
(O'Reilly C++ Pocket Reference).
I don't enjoy reading through a bunch of gobbledygook when I'm learning. I much prefer conciseness. Is this a good one to get started with, as I already have a programming background, VB as it is?
 
Old 06-03-2008, 03:06 PM   #10
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
You needn't ever worry about providing those libraries as most distributions come with them pre-installed, and even if they don't, it's easy enough to install them. The only toolkit you should ever have to worry about, is the one you plan to use and compile against. It's up to the user to have those libraries.

If you are used to VB and have never tinkered with any other language, C and C++ will comes as a bit of a twist; many concepts that C and C++ take for granted as things that are never left to the programmer in languages like VB.

Under Linux, you would use C to do low-level library programming, or programming where execution speed is beyond necessary, and while C++ can use C libraries and perform the same tasks, I've fallen under the impression that it's super easy to shoot yourself in the foot with C++. C also is used to hack the Linux kernel, as the kernel itself was written in C (and bits o' assembler). C++ is, however, NOT backwards-compatible; hence the reason for the separate "gtk" and "gtkmm" libraries.

C is a language I can understand (which isn't saying much), but C++ is something that completely escapes me. There isn't much difference between the languages, but coming from a BASIC, Perl and Common Lisp background, it's a bit of a brain-lurch for me (C++, that is).

If you aren't hellbent on learning C or C++, Python is a wonderful, portable language with more graphics toolkits than you can shake a stick at; it supports, practically, every graphical toolkit supported by C and C++, combined.

Alternately, if you want to avoid relying on other graphical toolkits, and making sure the user has the necessary libraries installed, you could learn Java and use the Swing toolkit.
 
Old 06-04-2008, 01:58 PM   #11
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Original Poster
Rep: Reputation: 164Reputation: 164
indienick,

You've given me a bit to think about. Sounds like I'm just going to have to play around and see what feels right.

Thank you for all your explanation.
 
Old 06-04-2008, 03:09 PM   #12
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
Qt is C++ from trolltech/nokia and linux has some licensing bees in it's bonnet over it.
Gtk is plain C from Gnu.

so first choice is easy it depends if you want C++ or C. (or if you care)

Gtk has awful documentation, I know, I use it.

I think generally, my observation is that the open-source world
seems to be drifting more towards Gtk than Qt.

either way, X programming is a little tricky generally.

I should think if you learn one toolkit you should get the hang of the next one easily
enough. they all work on similar principles.
 
Old 06-10-2008, 08:23 PM   #13
iwasapenguin
Member
 
Registered: Jul 2007
Posts: 110

Rep: Reputation: 15
This may also come as bit of a shock to you but under neath all of the user friendly KDE and GNOME
Linux is /very/ command line driven. I suggest that you learn at least one scripting language like python, perl, or ruby and C/C++ properly by writing "mouse-less" software first so that you can use
them correctly before having the additional headache of a graphical API on top of it.

Also it's probably best to learn both C and C++. They are in most respects the same thing but C++
allows for object orientated programming which makes it easier to juggle allot of info in your head
at once while C makes it very easy to know how the program talks to the OS and the OS talks to
the hard ware.
 
Old 06-11-2008, 02:48 AM   #14
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
that's probably good advice.
get to know the programming environment first.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Beginning programming mikeymorgan Programming 38 06-28-2005 07:59 AM
just beginning c programming mcd Programming 12 02-24-2005 05:06 PM
For those of you interested in programming, but don't know where to start: Fabyfakid Programming 0 11-06-2004 12:38 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration