C++ - segmentation fault when inheritance

前端 未结 1 878
被撕碎了的回忆
被撕碎了的回忆 2021-01-23 23:38

I got very strange behaviour with my very simple example which crashes when i use inheritance (class NapanaApplication : public QGuiApplication), but doesn\'t crash

1条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-23 23:47

    Note the signature of QGuiApplication:

    QGuiApplication(int & argc, char ** argv)
    

    Your function has int argc instead. I think you're causing a segfault when the integer value is then treated as a reference by the parent class constructor.

    0 讨论(0)
提交回复
热议问题