Beginner’s Guide to Compiling C and C++ Software in Linux

For people that are new to the GNU/Linux operating system, compiling software can be confusing. However, somewhat simple C and C++ packages can often be compiled with little to no hassle.

Before you begin, open up your package manager to verify that you have the “gcc” compiler installed. (This may include Synaptic and KPackage) Many GNU/Linux distributions that make claims towards user friendliness often do not include this in the default install. If you are on Ubuntu, you want the build-essential package.

Open up your terminal at this point. On the menu, this is often found in the System category. If you are unable to find this, you can run the program xterm.

Now you need to extract the source code. From the command line, use tar xfjv yourfilenamehere for .tar.bz2 files and tar xfvz yourfilenamehere for .tar.gz files. If you have source code in a zip file, use unzip yourfilenamehere.

Finally, we are going to change to the directory that was generated. Type in cd nameofdircetory to get there. If you are unsure as to the exact name, simply use the command: ls. This will list all of the files and directories in your home directory.

Now you are ready to actually compile the program. Use the following commands one after another. If they do not work, you need to consult the INSTALL file (more INSTALL) for instructions.

sudo make
sudo make install

If you encounter any errors after running ./configure, you probably need to install libraries. For compiling softwrare, you need to find the library that has -dev or -devel at the end of the name in your package manager, or it will not be usable to the compiler. For instance, if libglade were missing, you would need to install libglade-dev or libglade-devel.

Good job! You should now have a program compiled. There can be problems, especially with larger programs. If all searches and these tips fail, you may have to look for furthur documentation.


June 17, 2008 at 12:00 am 1 comment

Set up AdblocK in Konqueror 3.5

This article is now here:

June 14, 2008 at 3:41 pm 1 comment


Recent Posts