Advertisement

General programming in linux in C

Started by October 29, 2003 12:30 PM
3 comments, last by eedok 20 years, 10 months ago
Hello, Well my computer got abused and had to format the harddrive, previously I had a dual boot with Windows XP and Mandrake Linux(KDE as main DE), now I''ve only got Mandrake Linux. I''m familiar with building windows applications using the win32 api and lcc. Now I would like to try out making Linux applications, is there any good online references on doing so?
If you don''t know how to do anything under *nix, you should probably start with figuring out the compiler and such at the command line (you can work around things like this with some of the IDEs, but I''ll ignore that).

GCC will likely be installed and will certainly be included in your distro if it isn''t. After you''re done compiling single files, you might want to take a look at make (simply put: it handles dependencies between files); later on you might want to look into the GNU build tools (autoconf, automake, libtool) or something similar to avoid writing your own make files.

Once you know how to build things, you should probably learn a bit about POSIX and how it says the unix system libraries should be. For some documentation, try the glibc documentation.

For graphic applications you can take a couple routes. To give you a bunch of words to search for information on: If you''re trying to do games, I suggest looking into SDL and OpenGL. If you want to create GUI applications look into GTK+ or Qt .If you want to learn the lower level interface to X, take a look at Xlib and possibly GLX (to warn you: Xlib is kind-of esoteric).

For a decent number of topics, you can check The Linux Documentation Project''s Programming HOWTOs. If it''s not there (or even if it is, I suppose), try Google.

Advertisement
Linux programming is even easier than windows programming because you don''t have to work with a GUI by definition. Linux fully supports console applications, and they are not legacy in the least. In fact, most programs I use are console in nature.

However, once you begin to get interested in writing GUI apps for linux, gtk is the most popular C toolkit. And for C++, I _highly_ recommend gtkmm. (the C++ wrapper for gtk) Despite the fact its a wrapper, and not native C++, it is real C++. Qt uses its own frontend compiler extension to C++, and is a pain to deal with. (doesn''t make use of standard library things such as containers)

the real question of how to write a linux app isn''t "how do I write linux apps" that''s easy. The question is "how do I do what I want to do" which you always ahve to deal with.

So, what do you want to write? a game? (might I suggest using SDL and OpenGL?)
well.. at first just to make a program that makes a messagebox pop up when a button is clicked, then one that takes what I put into an editbox and have that pop up in a messagebox. If you know my name from somewhere else you can prolly guess what this all will lead to..
hmm I''m looking at glibs and seeing interesting things.. One thing I notice that differs is how memory works differently, how does linux work with memory when it comes to processes and windows? IE in windows to read and change the value of your ingame data you''d &value your value to somewhere you could see and do a readprocessmemory to read it or a writeprocessmemory to change it, how would I go about doing this in linux?

If this is the wrong place to ask just let me know..

This topic is closed to new replies.

Advertisement