variable 'QGraphicsView v' has initializer but incomplete type



  • Hello, the problem is:

    /home/u0807/QtApplication_2/main.cpp:182: ошибка: variable 'QGraphicsView     
    v' has initializer but incomplete type QGraphicsView v(&m);
                    ^
    
    #include <QGraphicsScene>
    #include <QGraphicsItem>
    int main(int argc, char *argv[]) {
        QApplication app(argc, argv);
        myClass m;
        QGraphicsView v(&m);
        v.setWindowFlags(Qt::FramelessWindowHint);
        v.setWindowFlags(Qt::WindowStaysOnTopHint);
        v.setRenderHints(QPainter::Antialiasing);
        v.show();
        v.setGeometry(1320, 610, 23, 125);
    
    return app.exec();
    

    }

    Please.



  • At the beginning, sign:

    #include <QGraphicsView>
    

    Explanation

    In Qt where forward-declarations are applicable only. This allows for the acceleration of the compilation, as it reduces the number of processed #include

    This error arises when the compiler has only a forward-declaration, and this place needs a complete definition.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2