1. 使用nvcc编译时出现的问题
/usr/include/c++/10/type_traits:71:52: error: redefinition of ‘constexpr const _Tp std::integral_constant<_Tp, __v>::value’
71 | template<typename _Tp, _Tp __v>
| ^
/usr/include/c++/10/type_traits:59:29: note: ‘constexpr const _Tp value’ previously declared here
59 | static constexpr _Tp value = __v;
| ^~~~~
2. 经过检查,nvcc与gcc g++版本不匹配
ls /usr/include/c++
10/ 12/
3. 安装适合nvcc的gcc g++后解决问题
sudo apt install gcc-11 g++-11
ls /usr/include/c++
10/ 11/ 12/