VS2015编译器错误C2282的文档? [英] Documentation for VS2015 Compiler Error C2282?

查看:233
本文介绍了VS2015编译器错误C2282的文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我在VS2015中遇到了一个奇怪的编译器错误C2282。我去查了一下,但我找不到任何相关信息。

I've come across a weird compiler error C2282 in VS2015. I went to look it up, but I couldn't find any information on it.

有这样的:  MSDN C2282

There is this: MSDN C2282

但是这引用了.NET 2003.我正在寻找与使用C ++的VS2015相关的东西。基本上我正试图从VS2013转移到VS2015及其平台工具集v140 \v140_xp。如果我使用v120 \v120_xp,相同的精确代码编译完全正常。
(VS2013)

However this references .NET 2003. I'm looking for something related to VS2015 using C++. Basically I'm trying to move from VS2013 to VS2015 and its platform toolsets v140\v140_xp. The same exact code compiles perfectly fine if I use v120\v120_xp. (VS2013)

它抱怨我怎么不能覆盖析构函数而我找不到任何关于此的信息编译器错误或弄清楚如何在单独的项目中重现它。如果有关于C2282的任何信息,那将是非常有帮助的。在尝试移动到VS2015时,我有这种类型的153
错误。我不想仅针对此编译器工具集进行任何类型的代码更改,尤其是对于跨平台项目。

It's complaining about how I can't override a destructor and I can't find any information on this compiler error or figure out how to reproduce it in a separate project. If there's any information about C2282, it would be incredibly helpful. I've got 153 errors of this type when trying to move to VS2015. I don't want to do any sort of code alterations just for this compiler toolset especially for a cross platform project.

这在Linux和OS X以及VS2013上编译都很好。我不想专门针对VS2015进行更改,这可能会破坏其他地方的建筑。我想知道为什么这个编译器抱怨并尽可能用项目选项修复它。

This compiles fine on both Linux and OS X, as well as VS2013. I don't want to make changes specifically for VS2015 that could break the building everywhere else. I want to know why this compiler is complaining and fix it with project options if at all possible.

推荐答案

为了重现错误的代码:

In order to reproduce the erroneous code:


Base

{

private

      
虚拟 ~Base()

      
{

       {

      
}

       }

};

 

class
派生
public
基础
//或'virtual public Base'

{

};

似乎是一些渐进式增强功能:

Seems that it were some progressive enhancements:

因此,现在上面的代码被视为无效。(在其他一些现代编译器中检查它)。

Therefore, now the above code is considered invalid. (Check it in some other modern compilers too).

如果这符合您的情况,可以通过将'private:'替换为
'protected:'来修复。我不认为这更改特定于Visual Studio 2015。

If this corresponds to your situation, it can be fixed by replacing ‘private:’ with ‘protected:’. I do not think that this change is specific to Visual Studio 2015.


这篇关于VS2015编译器错误C2282的文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆