Fixing – “Internal error: Segmentation fault”

Recently while compiling some programs I received an unique error message:

c++: Internal error: Segmentation fault (program cc1plus)
Please submit a full bug report.

Even compiling a simple Hello World program gave the same error.

To fix the problem I needed to use a program called debsums on Ubuntu. debsums is a program used to check the MD5 checksums of your installed deb packages. You can install it using the command:

sudo apt-get install debsums

and run it using the command:

debsums | grep -v OK

The above command lists all the packages which have not been installed correctly. If the following line is present in the output:

/usr/lib/gcc/i486-linux-gnu/4.4/cc1plus FAILED

then all you need to do to fix your system is the following command:

sudo apt-get –reinstall install g++-4.4

Now when you compile your code the earlier error shouldn’t appear.