在VS2013中使用NVCC编译时出现"modifier is not allowed on a destructor"错误
"modifier is not allowed on a destructor" error when compiled with nvcc in VS2013
我在Visual Studio 2013上,正在尝试编译一个利用继承和C++11的CUDA代码。下面的代码返回"析构函数上不允许修饰符"错误,因为"覆盖"。
// derived.cuh
class derived : public base
{
public:
derived();
~derived() override;
};
其中基类的析构函数是虚拟的。完全相同的代码在 Ubuntu 上编译得很好。如果我将 .cu 和 .cuh 更改为 .cpp 并且启用了 .h,则完全相同的代码也可以使用默认的 Visual studio c++ 编译器进行编译。 C++11 已启用,因为如果"覆盖"附加到普通函数上,它也可以很好地编译。请参阅下面的示例,
// derived2.cuh
class derived2 : public base
{
public:
derived2();
~derived2();
void func() override;
};
其中 func() 是基类中的虚函数。
在VS2013中使用nvcc编译时,如何摆脱"析构函数上不允许修改器"错误?
向 NVIDIA 提交了这个错误,他们回复说这将在下一个 CUDA 版本(大概是 8.0)中修复。
相关文章:
- Is !NaN not a NaN?
- Directx 11 - CompileFromFile() is not compiling
- Centos7 g++ "to_string is not in a member of std"
- 将成员函数作为构造函数参数调用时出错 "Variable is not a type name"
- reference_wrapper导致"incomplete type is not allowed"
- 结构中的错误"Incomplete type is not allowed"
- 这在C++ "It does not own the underlying data, and so is cheap to copy or assign"中意味着什么
- "Called Object Type is Not a Function or Pointer" 与 typedef 和类
- 无法创建 DLL:获取 DLL "is not a valid Win32 application"
- Atom gpp编译器给出"'C:UsersadminUser' is not recognized as an internal or..."错误
- 当我编译XG-Bosst时,出现错误"error: 'Split' is not a member of 'xgboost::common' ……"
- C++ DLL 运行时错误"abc.dll is not a valid WIN32 application" 。请帮助解决这个问题
- QString::utf16(): Is it UB or not?
- 如何修复 eigen3 中的'non-type template argument is not a constant expression'?
- 我的代码应该接受一个数字,并返回字母等级或"Grade is not valid"但 else 语句不起作用
- 如何修复此错误"the value of 'x1' is not usable in a constant expression"?static_assert
- 加载安全区图像"A device attached to the system is not functioning"
- 巴泽尔中的错误"name 'new_local_repository' is not defined"
- 如何修复 SDL2 "GLSL 3.30 is not supported"错误
- 函数模板(它是类模板的成员)的显式专用化会产生"partial specialization is not allowed"错误,为什么?