Solution 1:

The packages available for download are the Debian version. These are incompatible on Ubuntu because of conflicting files. Codeblocks is available from the default Universe repository on Ubuntu (version 20.03-3). Also, the Ubuntu packages were consolidated into a handful of packages so there's no need to download anything extra.

First, uninstall the debian codeblocks packages using the following command:

sudo dpkg -P $(dpkg -l | grep codeblocks | awk '{print $2}') libwxsmithlib0 libwxsmithlib0-dev wxsmith-dev wxsmith-headers

Then, run the following commands to update your package list and reinstall codeblocks from the Ubuntu repositories:

sudo add-apt repository universe
sudo apt update
sudo apt install --reinstall $(apt-cache search codeblocks | awk '{print $1}')

To explain the commands used, the following command searches for and lists packages related to codeblocks:

apt-cache search codeblocks

The first column (on the left) lists the package names. So, to list only the package names, we can use awk to print only the first column which is represented by $1 like this:

apt-cache search codeblocks | awk '{print $1}'

To insert the output of that command into another command, we can use $(). So to install the packages listed by the command above, we can use the following command:

sudo apt install --reinstall $(apt-cache search codeblocks | awk '{print $1}')

Additional help:

To search for available packages, you can use apt-cache search like this:

apt-cache search codeblocks

To filter the results to only include results that contain the word "codeblocks", we can use the grep command like this:

apt-cache search codeblocks | grep -i codeblocks

For more information about a specific package, we can use the apt-cache show command like this:

apt-cache show codeblocks

To list all installed packages, we can use dpkg -l and filter the results like this:

dpkg -l | grep codeblocks

Click here for more info about dpkg status codes (e.g., ii, iU, etc.). Basically, ii means fully installed and iU means that the package is not fully installed.