If you are a programmer and want to write some applications for the Linux Desktop, you need to know some basics before rolling up your sleeves and starting. We look at development and porting as well as choosing the right Integrated Development Environment.
If you want to start Linux application development for the Linux desktop, first of all realize principles for the programming are the same, whether it is developing a Linux application or a Windows application. If you have a little bit of programming experience, then you already know most of what you need.
If you want to work with Java, then you are already ready. The development environment and the codes are the same (this is why Java was developed.) and you can just download your favorite IDE and start working. If you want to work with C/C++, then you should check some documents on the Internet to see the differences for programming Linux. Again, the basics will be the same, but there will be some minor issues here and there.
Besides Java and C++, you have Perl, Ruby, Python and -to some degree- BASIC. Once you have decided on the language, you need to select a library for the visual elements.
Visual Elements: QT or GTK?
The basics: QT is the library used in K Desktop Environment whereas GTK is used in Gnome. But this does not mean that you cannot use QT Linux applications in Gnome environment or GTK applications in KDE. It’s just a matter of “where the program looks native to the desktop environment." The best way is to compare the two user interface frameworks with the -almost- same programs. The screenshots show the GEdit, written in GTK and KEdit, written in QT. You will immediately see the difference between the two interfaces.
Gedit and KEdit: A Visual Comparison of GTK and QT
There is extensive documentation on the Internet about programming Linux interfaces with the QT and GTK frameworks. It is not possible to recommend one over another, since it depends on which programming environment the developer is comfortable with. In order to avoid confusion, loss of time and resources, I strongly recommend checking the developer documents before deciding. Once you have chosen the framework, you have decided almost everything to create your Linux program.
Porting Windows Code to Linux
If you already have your code working in Windows and you want to port it to Linux, then you need to make sure that the programming language which you used also works in Linux. For example, if you have developed your Linux program with C/C++, then you can just check the GCC (GNU C Compiler) documentation and correct some points to make the code compile in Linux. A good starting point might be to check IBM’s Developer Works website, which includes a guide for porting C code to Linux.
If you have developed your application using C# or .Net, which are Windows-native languages, then you may need to use Mono.
Integrated Development Environment (IDE)
Like the distro-wars, there is never a conclusion about which Integrated Development Environment (IDE) is the best. As Linux is full of choices, the developers have a couple of IDEs to choose from. There are integrated suites such as KDevelop, Eclipse, Anjuta and NetBeans. If you want everything to be “clean", then Kate will be of use to you. Kate is a simple text editor for KDE but can understand and highlight code for many languages.
You can google about Linux IDEs and choose the one that suits you best. If you will be porting your code from Visual Studio to Linux, then don’t forget to have a look at NetBeans, which has a Visual Studio Project Importer plugin.
In this article we have just scratched the surface about programming Linux for desktop applications. The process is harder than it sounds, but it pays to know what you, as the developer, will face before you get your hands dirty with the coding. Decide on the language with which you will develop your application, read about the Linux-specific parts of the language’s compiler, decide on the user interface toolkit and start coding to create your ultimate Linux program!