“The CC version check failed” is reported when Ubuntu installs NVIDIA graphics card driver

I have referred to the questions answered by many bloggers, but there are many problems or troubles. I recommend a better solution after I try to solve it:

The reason for this problem is that the driver may be relatively new, and the GCC version of the system kernel is inconsistent with the default GCC version of the compiler. First, GCC -v check the default GCC version of the current compiler. If it is relatively low and you have not updated the GCC version, upgrade the GCC and C + + versions: sudo apt get install gcc-9 G + ± 9 – Y

Then open the installation path to see the GCC versions: LS/usr/bin/GCC*

Generally, the GCC version has been upgraded. If there are multiple versions in this directory, set the soft connection between GCC and G + +:
CD/usr/bin

sudo ln -sf gcc-9 gcc
sudo ln -sf g+±9 g++

Finally, just update the environment:
source/etc/environment

At this time, GCC -v check the GCC version of the current compiler. If it is consistent with the version prompted by the kernel, you can install it according to the normal graphics card driver steps

Read More: