App is crashing for unknown reasons...
-
Console shows this :
09:24:17: Starting D:\build-segyviewer-Desktop_Qt_5_12_5_MinGW_64_bit-Debug\debug\SegyViewer.exe ...
QWidget: Must construct a QApplication before a QWidget
09:24:26: The program has unexpectedly finished.
09:24:26: The process was ended forcefully.
09:24:26: D:/build-segyviewer-Desktop_Qt_5_12_5_MinGW_64_bit-Debug/debug/SegyViewer.exe crashed.I got code from here:
https://github.com/uqzzhao/SegyViewer.git -
UIse a debugger, see where it crashes, fix it - the normal work for a developer...
-
I used debugger, it has took me to line 626 of ui_mainwindow.h
10:05:33: Starting D:\build-segyviewer-Desktop_Qt_5_12_5_MinGW_64_bit-Debug\debug\SegyViewer.exe ...
QWidget: Must construct a QApplication before a QWidget
10:05:37: The program has unexpectedly finished.
10:05:37: The process was ended forcefully.
10:05:38: D:/build-segyviewer-Desktop_Qt_5_12_5_MinGW_64_bit-Debug/debug/SegyViewer.exe crashed. -
@rockonrover said in App is crashing for unknown reasons...:
it has took me to line 626 of ui_mainwindow.h
We do not know what is in that line...
Please post the stack trace after the crash. -
@rockonrover Given the warning, "QWidget: Must construct a QApplication before a QWidget", ask yourself:
- Does my main() construct a QApplication object at all?
- Does my application create any QWidgets before it constructs the QApplication? They could be explicitly created in main() before QApplication, or because you have QWidget objects as statics, file or global variables.