[英]“modifier is not allowed on a destructor” error when compiled with nvcc in VS2013
I am on Visual Studio 2013 and is trying to compile a CUDA code that utilizes inheritance and C++11. 我在Visual Studio 2013上,正在尝试编译一个利用继承和C ++ 11的CUDA代码。 The code below returns "modifier is not allowed on a destructor" error because of the "override".
由于“覆盖”,下面的代码返回“析构函数不允许修饰符”错误。
// derived.cuh
class derived : public base
{
public:
derived();
~derived() override;
};
where the destructor of the base class is virtual. 基类的析构函数是虚拟的。 The exact same code compiles fine on Ubuntu.
完全相同的代码在Ubuntu上编译得很好。 The exact same code also compiles fine with default Visual studio c++ compiler if I change the .cu and .cuh to .cpp and .h.
如果我将.cu和.cuh更改为.cpp和.h,完全相同的代码也可以使用默认的Visual Studio c ++编译器编译。 C++11 is enabled because if the "override" is appended on a normal function it also compiles fine.
C ++ 11已启用,因为如果“覆盖”附加在普通函数上,它也可以编译。 See example below,
见下面的例子,
// derived2.cuh
class derived2 : public base
{
public:
derived2();
~derived2();
void func() override;
};
where func() is an virtual function in the base class. 其中func()是基类中的虚函数。
How to get rid of the "modifier is not allowed on a destructor" error when compiled with nvcc in VS2013? 在VS2013中使用nvcc编译时如何摆脱“修改器不允许在析构函数上”错误?
将此错误提交给NVIDIA,他们回复说这将在下一个CUDA版本中修复(大概是8.0)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.