Linux C++ IDE

Here are some notes on my experience of setting up a Linux operating system and then installing on it a C++ Integrated Development Environment.

The aim is to setup a C++ IDE which is completely free and which is suitable for advanced C++ development.

Step 1 - Which Linux Distribution?

Distrowatch provides details on some of the top distributions:

Distrowatch also measures the popularity of all distributions.

My choice is Ubuntu, because (1) it is the most popular distribution at the moment and (2) I like the underlying philosophy.

The choice of a distribution also needs to take into account the specification of the underlying hardware.

In the case of Ubuntu, the recommended system requirements are:

Processor Speed 1 GHz
RAM 512 MB
Hard Disk 5 GB
Video 1024 x 768

Other "lightweight" distributions (such as e.g. Xubuntu, Puppy Linux or Damn Small Linux) may be compatible with lower spec hardware, but then with lower spec hardware it would also be necessary to install a lightweight IDE instead of a professional one.

[*TO DO* measure the max resource usage after a full IDE installation, which may be higher than the above spec]

Step 2 - Which Edition?

The choices are:

My choice is the Desktop Edition as I will be running a single PC and not a network of PCs.

Next, the choice is whether to go for Ubuntu or for one of its derivatives, such as:

  • Kubuntu - based on the K desktop environment instead of the GNOME desktop environment
  • Edubuntu - for classrooms
  • Xubuntu - based on the Xfce desktop environment

My choice is to stick with the default edition of Ubuntu.

Step 3 - Which Release?

To date the releases are:

4.10 Warty Warthog
5.04 Hoary Hedgehog
5.10 Breezy Badger
6.06 Dapper Drake Long Term Support
6.10 Edgy Eft
7.04 Feisty Fawn
7.10 Gutsy Gibbon
8.04 Hardy Heron Long Term Support
8.10 Intrepid Ibex
9.04 Jaunty Jackalope
9.10 Karmic Koala
10.04 Lucid Lynx Long Term Support

Note that the version numbers reflect the year and the month of the releases. For instance Lucid Lynx is year 10 (2010) month 04 (April).

On installing Ubuntu for the first time, my choice is to go for the latest release, irrespective of whether it is a Long Term Support (LTS) one or not.

Then, when deciding on whether to upgrade to a newer release, I would consider the following issues:

  • Is the installed release a LTS one?
  • Does the newer release add relevant functionality or clears any problems or limitations that affect the installed release?
  • Does the newer release have any new limitations or problems with respect to the installed release?

Step 4 - Which Installation CD?

The choices are:

My initial choice would be the default desktop installation CD, as recommended.

Should the installation get stuck without indicating the cause of the problem(s), I would try the graphical installation once more, this time selecting F4 "Safe graphics mode".

If this doesn't solve the problem, then I would go for the alternate desktop installation CD.

Note that the text-based interface of the alternate installer only applies to the installation process; the installed operating system will be the same with either CDs.

Step 5 - Ubuntu Installation

Here are a few notes about some choices I have made and some issues I have encountered during the installation process.

The Ubuntu Forums is a good place to get some advice from other users who may have come across and solved any problems that may arise during installation.

During installation the PC needs to be connected to the Internet as some updates will be automatically downloaded.

The connection to the Internet/Modem/Router should be via a cable rather than a wireless adapter, so that the network may be configured - if not, the installer will display the message "Network autoconfiguration failed".

When offered the options on how to partition the hard disk, my choice is to go for the default: "Erase and use the entire disk" (beware that with this option anything that you currently have on the hard disk - including the operating system - gets erased).

This creates a partition "sda1" (the equivalent of e.g. "C:" in windows) formatted with the "ext4" file system (the equivalent of e.g. "NTFS" in Windows), which covers most of the hard disk.

Just ignore the additional swap partition sda5, which is created for use by the operating system.

After logging in Ubuntu for the first time the Update Manager window should pop up (alternatively the Update Manager can be started via the menu option System —> Administration —> Update Manager). Request to install all updates. The PC will also need to be restarted for the installation to take effect.

The screen resolution can be changed via System —> Preferences —> Monitors.

If the monitor is shown as Unknown and only a subset of the supported resolutions are detected, it may be necessary to tinker with the xorg.conf file. Here is an example. In brief:

  • From the specifications of your monitor Identify the ranges of horizontal and vertical refresh frequencies.
  • Generate a default xorg.conf file in /etc/X11
  • Edit xorg.conf
  • Add the HorizSync and VertRefresh range definitions
  • Reboot the PC
  • The supported resolutions should now be available
  • Identify those that work
  • Use the cvt command to derive the relative Modeline definitions
  • Edit xorg.conf
  • Comment out the HorizSync and VertRefresh range definitions
  • Add the Modeline definitions
  • Reboot the PC
  • The specified resolutions should now be available

Step 6 - Additional Basic Packages

There are some additional utilities that I think are also worth installing.

Ubuntu offers a long list of "packages" that can be selected for installation. These packages are then automatically downloaded from appropriate online repositories and installed. There is no need to manually search, download and run the appropriate installation executables.

My favourite method of installation is through the Synaptic Package Manager:

  • Ensure that the PC is connected to the Internet
  • Start the Synaptic Package Manager (via System —> Administration —> Synaptic Package Manager)
  • Locate the relevant package
  • Click on the tickbox next to it
  • From the popup menu select Mark for Installation
  • If prompted, mark the additional required changes
  • Click the Apply icon

Note: a green status box next to a package indicates that the package has been installed.

Note: an alternative method is to open a shell and type "sudo aptitude install xxxx" (where xxxx is the name of the package), but I am rather prejudiced against that… why should I have to learn about shell commands when there are graphical applications that can hide these unnecessary details from me?


Can be installed via Synaptic Package Manager —> System Administration (universe) —> gufw.

Gufw is a basic graphical application that can be used to enable the default Ubuntu firewall.

Upon installation, Gufw can be started via System —> Administration —> Firewall configuration.

To enable the firewall start Gufw, tick the Firewall enabled tickbox and leave the default selection to Deny incoming traffic (the shield icon should then become green).

For a more advanced firewall configuration an alternative graphical application is Firestarter and some technical information on the Ubuntu firewall can be found here.


Can be installed via Synaptic Package Manager —> Gnome Desktop Environment —> gparted.

GParted is an application for handling partitions and file systems.

In particular, the default Ubuntu installation does not support the formatting of hard drives and GParted can be used for that.

After installation, GParted can be started via System —> Administration —> GParted


Can be installed via Synaptic Package Manager —> Networking —> samba.

Samba is an application for allowing PCs on the same network to see each other's folders and printers.

With Samba it is possible to share folders with PCs running Windows, as well as Linux.

After installation, to make a folder visible over the network right click on it, select Sharing Options, tick the Share this folder box and click the Create Share button.

To find any shared folders on other PCs select Places —> Network.

As a test, in Places —> Network, besides the "Windows Network" folder, it should be possible to see a folder for the own PC, from which it should be possible to access any shared folders created.

Additional fixes may be required to make Samba work, see the thread Howto: Fix Windows share browsing issues.

In particular, in order to prevent the firewall from blocking Samba browsing, start System —> Administration —> Firewall Configuration and Add the following Simple rules:

  • Allow UDP 137
  • Allow UDP 138
  • Allow TCP 139
  • Allow TCP 445

(note: as of Ubuntu 9.10 I cannot make Samba work myself, so I am giving up on this package).

The Network File System (NFS) is a possible alternative to Samba.

[*TO DO* add more packages, if relevant]

Step 7 - Manual Setup

Root File Browser

The shell command to start the File Browser (or any other graphical application) with root privileges is "gksudo nautilus".

However I want to hide these unnecessary shell details behind a dedicated launcher:

  • Right click on e.g. the Application menu
  • Select Edit Menus
  • In the Menus list select Applications
  • Click New Menu
  • Name it My
  • In the Menus list select My
  • Click + New Item
  • In Create Launcher select Type: Application, Name: Root - File Browser, Command: gksudo nautilus
  • In Create Launcher click the icon to pop up the Browse Icons window
  • Open the /usr/share/pixmaps/nautilus.xpm icon (alternatively browse and open the /usr/share/icons/hicolor/scalable/apps/nautilus.svg icon)
  • OK and close the menu editor
  • Select Application —> My —> Root - File Browser
  • You will be prompted for your user password (in order to acquire root privileges)
  • A File Browser with root privileges will then start

Wireless Connection

This just went smoothly for me; what I did:

  • Plug in the USB adapter for the Wireless Network
  • Right click the Network Connection icon on the menu bar
  • Ensure that Enable Wireless is selected
  • Left click the Network Connection icon on the menu bar
  • Click on the relevant Wireless Network
  • Type in the password

Web Browser

  • Click on the Firefox Web Browser icon on the menu bar
  • Check that the Internet is accessible
  • Via Edit —> Preferences it is possible to set the Homepage

Step 8 - Which C++ compiler?

The default C++ compiler in Ubuntu is g++, which is part of the GNU Compiler Collection (GCC).

It can be installed via Synaptic Package Manager —> Development —> build-essential.

Note that the Development section contains the g++ and g++-4.4 packages relative to the GNU C++ compiler and that these packages will also be installed via build-essential. Likewise for the libstdc++6-4.4-dev package - in the Libraries - Development section - which is relative to the C++ Standard Library.

Here are some instructions on how to compile simple C and C++ programs.

Step 9 - Which IDE?

On Wikipedia there is a comparison table for Integrated Development Environments for C/C++.

From that table it is possible to derive a shortlist of non proprietary IDEs which run under Linux:

My initial preference would be for Eclipse. Eclipse and NetBeans appear to be the two "heavyweight" IDEs that are mostly supported by the industry, with Eclipse appearing to have the strongest support at the moment.

Step 10 - Eclipse and CDT Installation

Eclipse is an open development platform that can support different programming languages.

For Eclipse to support the C++ programming language, the Eclipse C/C++ Development Tooling (CDT) also needs to be installed.

Eclipse can be installed through Synaptic Package Manager —> Development (Universe) —> eclipse and after installation the Applications —> Programming —> Eclipse menu option will become available.

My preference however is to go for a direct User Installation of Eclipse, to ensure that the latest version of Eclipse is downloaded and that the CDT plugin can be downloaded without having to run Eclipse with root privileges.

With a user installation, on deciding where to install Eclipse (or any other files in general) it is worth considering the Filesystem Hierarchy Standard (FHS).

Eclipse depends on the Java Development Kit (JDK). The choice is between the Sun JDK (package sun-java6-jdk) and the Open JDK (package openjdk-6-jdk). My initial preference would be to try the Open JDK and fall back to the Sun JDK if I encounter any problems.

So this is my approach for the Eclipse user installation:

  • Through Synaptic Package Manager install Development —> openjdk-6-jdk
  • Go to the Eclipse Downloads page
  • Download Eclipse Classic (tar.gz archive)
  • Extract its contents (an eclipse folder will appear)
  • Start the Root File Browser and click File System to access the /opt folder
  • Move the eclipse folder under /opt
  • In /opt create a bin folder
  • In /opt/bin create a new empty file named eclipse
  • Double click the eclipse file to edit it and add the following:
export ECLIPSE_HOME="/opt/eclipse"
$ECLIPSE_HOME/eclipse $*
  • From the eclipse file Properties —> Permissions enable Allow executing file as program
  • Right click on the menu bar Applications and select Edit Menus
  • Add a new item to the Programming menu: Type Application - Name Eclipse - Command /opt/bin/eclipse - Icon /opt/eclipse/icon.xpm

On running Eclipse for the first time you will be prompted for a workspace directory; in the suggested path I would replace workspace with Eclipse/Workspace (and then use the Eclipse directory to store anything Eclipse related).

The CDT Downloads Page provides some information on how to install the CDT.

Having the Eclipse Ganymede version, here is what I do:

  • Start Eclipse
  • Select Help —> Software Updates
  • Click the Available Software tab
  • If the Ganymede Update Site and the Eclipse Project Updates entries are not available, click the Manage Sites button and add them
  • Tick the Ganymede Update Site —> C and C++ Development —> Eclipse C and C++ Development Tools
  • Click Install
  • On completing the installation restart Eclipse

I don't install the other two entries: "Eclipse C and C++ Development Platform" is just a subset of "Eclipse C and C++ Development Tools", and "Mylyn Bridge: C/C++ Development" is about task management.

Step 11 - Eclipse/CDT Tutorials

This Video Tutorial by Mark Dexter is a good introduction on how to use the Eclipse Workbench.

The Eclipse Help will include a C/C++ Development User Guide with a Getting Started section showing how to build and run a Hello World C++ application. The Eclipse Help is also available online.

Step 12 - Which GUI Toolkit?

To develop applications that have a Graphical User Interface (GUI), besides a basic C++ compiler it is also necessary to use a GUI Toolkit, also known as Widget Toolkit.

A Widget is an element of a graphical user interface, such as a Window, Text Box, Button, Menu, Icon, etc.

The layout of Widgets in a GUI can be defined using a GUI Builder, also known as GUI designer.

I'm looking for a GUI Toolkit with the following characteristics:

  • Free
  • Supports C++
  • Heavyweight
  • Cross-platform
  • With a GUI Builder

The most popular GUI Toolkits appear to be:

On the whole Qt (pronounced like 'cute') is receiving perhaps the most favourable comments from software developers, so that's going to be my first choice.

Step 13 - Qt Installation

Qt could be installed through Synaptic Package Manager —> Development —> qt4-dev-tools.

After installation the Qt4 Assistant, Qt4 Designer and Qt4 Linguist menu options would become available in Applications —> Programming, and Qt shell commands such as qmake could also be executed from a terminal window.

As of Intrepid Ibex however the Synaptic Package Manager would download Qt version 4.3.3, which is now obsolete. At the time of writing the latest Qt version is 4.5.0. Note that version 4.5.0 is the first Qt version to be released under the LGPL license, and in particular that applications developed with Qt under this license are no longer required to be open source.

So my choice is to go for a user installation:

  • Download the Qt SDK for Linux installer (a .bin file) to the desktop
  • Right click on the installer's icon and select Properties
  • In the Permissions tab enable the Allow executing file as program option
  • In the Open With tab add the custom command gksudo (note that this command will be associated with all .bin files)
  • Double click the .bin file icon
  • Follow the installation instructions, accepting the defaults
  • When the installation completes, the Qt Creator menu option will become available in Applications —> Programming

Qt Creator is a lightweight C++ IDE for building Qt applications, which can be ignored here as it is redundant with the Eclipse IDE.

Next an Eclipse plugin - Qt Eclipse Integration for C++ - needs to be installed to make Qt accessible from Eclipse.

Here is the download and the installation instructions.

Here is what I do:

  • Download the Qt Eclipse Integration for C++ plugin (a .tar.gz file) to the desktop
  • Right click and select Extract Here
  • An eclipse folder will be created
  • Run the Root File Browser and go to the /opt directory
  • Cut and paste the eclipse directory from the desktop to /opt
  • When prompted, select to Merge All folders
  • Run a terminal window and enter: /opt/bin/eclipse -clean
  • Exit Eclipse, close the terminal window
  • Start Eclipse
  • Confirm that the Help contains the Qt Development User Guide

[*TO DO* a reference to a Qt Tutorial]

Step 14 - Version Control

Here is a good introduction to Version Control.

Here is a comparison of different version control systems.

Version control systems can be centralised or distributed. With a centralised version control system the controlled items are stored in a central repository and access to this repository is synchronised. With a distributed version control systems there are instead different working copies that can be kept up to date with each other by peer-to-peer exchange of updates.

The most popular free centralised version control systems seem to be:

The most popular free distributed version control systems seem to be:

As I am developing software on my own and I have an instinctive preference for a master repository I'll go for the centralised approach. I'll go for Subversion, as it is an actively developed tool whose goal is to replace CVS.

[*TO DO* Expand on the following]



Step 15 - Backup

My idea is to carry out a very simple manual backup procedure:

  • Insert a live CD with disk cloning software into the CD/DVD drive
  • Switch off the PC
  • Connect an external hard drive to the PC via a USB port
  • Switch on the PC
  • Ensure that the live CD software runs, instead of the operating system
  • Request to copy the full content of the PC hard drive to the external hard drive

So first thing is to get an external hard disk formatted.

This can be done using GParted.

  • Plug in the external hard disk
  • Ensure that its content is not important… that it is OK to wipe it out
  • Ensure the disk is not mounted (if the disk icon is shown on the desktop, right click on it and select Unmount)
  • Select System —> Administration —> Partition Editor to start GParted
  • Select the external hard drive via GParted —> Devices (drives are identified as e.g. /dev/sda and /dev/sdb)
  • Select View —> Device Information and check it's the correct drive
  • Select Device —> Create Partition Table
  • Accept the default msdos format
  • Click on the "unallocated" strip to select it
  • Select Partition —> New
  • Select the Primary partition type
  • Select ext3
  • Click Apply
  • Let the formatting of the disk complete - it may take some time.
  • Select Partition —> Label
  • Label the drive e.g. Backup
  • Click Apply
  • Exit GParted
  • Switch off the external drive for a few seconds and then on again
  • The Backup drive icon will appear on the desktop
  • The Places —> Backup menu selection will become available (note: this can now be used to remount the drive)

[*TO DO* some comments about ext2, ext3, ntfs, fat choices… speed, safety, compatibility?]

You may find that the formatted drive is read only.

  • Double click on the Backup icon to show the driver's content
  • Right click on the File Browser right pane
  • Select Properties
  • Select the Permissions tab

This may show that only the owner root can Create and delete files.

To gain write access to the Backup drive use the Root File Browser.

Next some disk cloning software is needed.

Wikipedia offers a comparison table for free disk cloning sofware.

My preference is for Clonezilla (also FOG looks quite good, but unfortunately it does not provide a live CD).

Once the Clonezilla Live CD is downloaded and burnt:

  • Insert the CD in the drive
  • Shut down PC
  • Ensure that the external drive Backup is connected and powered on
  • Power up the PC
  • Ensure that Clonezilla runs instead of Ubuntu
  • Go through the various selections as guided, sticking to the recommended defaults
  • In my simple configuration the partitions come up as hdc1 & hdc2 (internal HD) and sda1 (external HD).
  • On savedisk I am naming my image Clonezilla-MyPCName-YYMMDD (where YYMMDD is year, month, day)

If the above procedure fails, one thing to try is to re-run it in Failsafe mode (instead of the default VGA 1024x768 screen mode).

Next, it's worth testing at least with this first backup that it can be restored.

To do so I need first to wipe out Ubuntu from the hard disk.

Free disk wipe software that looks good is Darik's Boot And Nuke (DBAN).

After downloading and burning the CD:

  • Insert the CD in the drive
  • Shut down the PC
  • Disconnect the external Backup disk and any other thingy - just in case! :)
  • Power up the PC
  • Ensuring that DBAN runs instead of Ubuntu
  • Don't need a thorough wipe here, so I'll go for Quick Erase, Verify Off, Rounds 1
  • Let the wipe complete
  • Remove the DBAN CD
  • Restart the PC and verify that it fails to boot

Now the Clonezilla restore, just as per savedisk except that the option is now restoredisk.

After restore, reboot and verify that Ubuntu is back and working.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License