ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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).
@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.
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
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.
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.
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.
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.
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?
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.