我想在Visual Studio 2015上显示这样的警告/错误(用lang):

/home/travis/build/x/x/src/guiComboBox.cpp:454:19: error:

      allocating an object of abstract class type 'GUIListBox'

                m_listbox = new GUIListBox(Environment, this, -1, r, fal...

                                ^

/usr/include/y/IGUIListBox.h:88:16: note: unimplemented pure virtual

      method 'setItemOverrideColor' in 'GUIListBox'

                virtual void setItemOverrideColor(u32 index, const video...

                             ^

/usr/include/y/IGUIListBox.h:91:16: note: unimplemented pure virtual

      method 'setItemOverrideColor' in 'GUIListBox'

                virtual void setItemOverrideColor(u32 index, EGUI_LISTBO...

我在Clang中遇到此错误,但在Visual Studio 2015中却没有。有人可以帮助我吗?

最佳答案

Visual Studio将显示以下错误:

class Abstract
{
  virtual void NotImplemented() = 0;
};

int main()
{
  // error C2259 : 'Abstract' : cannot instantiate abstract class
  // note: due to following members :
  // note: 'void Abstract::NotImplemented(void)' : is abstract
  // note: see declaration of 'Abstract::NotImplemented'
  Abstract* a = new Abstract();

  return 0;
}

关于c++ - 如何在Visual Studio 2015中显示 “unimplemented pure virtual”?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/42765567/

10-13 03:05