cuda error gcc(unsupported GNU version! gcc versions later than 5 are not supported)

/usr/local/cuda/include/host_config.h:119:2: error: #error -- unsupported GNU version! gcc versions later than 5 are not supported!
 #error -- unsupported GNU version! gcc versions later than 5 are not supported!

错误的解决方式很简单,就是安装低版本gcc和g++,并创建链接或更改gcc各版本的优先级。

sudo apt-get install gcc-5

sudo apt-get install g++-5


sudo apt-get install gcc-7

sudo apt-get install g++-7

创建软链接:

sudo ln -s /usr/bin/gcc-6 /usr/local/cuda/bin/gcc

sudo ln -s /usr/bin/g+±6 /usr/local/cuda/bin/g++

或者更改gcc版本进行适配:

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60--slave /usr/bin/g++ g++ /usr/bin/g++-5

参考文章:

  • 安装或更改gcc版本
  • 版本升降

你可能感兴趣的:(cuda error gcc(unsupported GNU version! gcc versions later than 5 are not supported))