The silly qt creator building/debugging system always causes trouble for me. This is the error message popped(“Unexpected CDB Exit” is the window title, “The CDB process terminated” is the content displayed on the window) when I tried to debug a program. In the “Application Output” tab of qt creator, there are only two lines of messages:
16:14:44: Debugging starts
16:14:45: Debugging has finished
No message appears in the Issue tab, the Debugger Console tab and the General Messages tab. No other clue to the root cause of the problem. I set a breakpoint at the first line of the main function, hoping it can stop there and I’ll investigate further, but the execution cannot reach that line. Maybe the program has some problem in the runtime lib that is executed before the main function? There is a menu item “Start and Break on Main(F10)” under the Debug menu but that does not work either. The “Unexpected CDB Exit” message box always pops up before the execution can reach any breakpoint. I do not know how qt creator calls CDB to debug a program. If qt creator showed the command line of calling CDB and the result got from CDB, I would have some knowledge of what happened. Now, Qt creator hides everything about this failure and does not tell you the truth behind it. It is time to use your brain and experience to fight against qt creator.
I changed many parameters in the .pro file, ran qmake, cleaned, rebuilt the project, but the problem persisted. I created another simple Qt Widget based project and that project can build/debug successfully, which made me sure that the problem is in the project itself, not the Qt creator or build environment.
Finally, I found the root cause of this problem. I did not set the path to a dll(openssl dll) that is required by the application. (BTW, you can know what dlls are lacked/missing/not found by clicking and running the program.) Without the path, Windows cannot even load the program, not to say start to run it. That is why it cannot run to any breakpoint I set in the program. The cure is simple: add the path to the dll to the PATH environment variable and restart Qt creator. Now I can debug the program without a problem.