C++ - segmentation fault when inheritance

前端 未结 1 877
被撕碎了的回忆
被撕碎了的回忆 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条回答
  • 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)
提交回复
热议问题