我用-MT(修改配置文件)编译了QT动态
我的代码是这样的(我的程序也是MT的发布模式):
int main( int argc, char *argv[] )
{
int ret = 0;
if( 0 == ret )
{
QApplication a( argc, argv );
{
test01 w;
w.show();
ret = a.exec();
}
}
return ret;
}
test01 is very simple like this:
class test01 : public QMainWindow
{
Q_OBJECT
public:
test01(QWidget *parent = 0);
~test01();
private:
Ui::test01Class ui;
};
一切正常,但是当离开main函数时,它崩溃了:
[enter image description here][1]
有人会帮助我吗?
最佳答案
[enter image description here][1]
ntdll.dll!_RtlFreeHeap@12()未知
kernel32.dll!_HeapFree@12()未知
qwindows.dll!_free_base(void * block=0x00425dc0) Line 112 C++ qwindows.dll!free(void * block=0x00425dc0) Line 30 C++ qwindows.dll!operator delete(void * block=0x00425dc0, unsigned int formal=8) Line 15 C++ qwindows.dll!QWindowsIntegrationPlugin::
scalar deleting destructor'(unsigned int) C++ Qt5Core.dll!QLibraryPrivate::unload(QLibraryPrivate::UnloadFlag flag=UnloadSys) Line 558 C++ Qt5Core.dll!QFactoryLoaderPrivate::~QFactoryLoaderPrivate() Line 87 C++ Qt5Core.dll!QFactoryLoaderPrivate::
scalar deleting destructor'(unsigned int) C++ Qt5Core.dll!QObject::~QObject() Line 1049 C++ Qt5Core.dll!QFactoryLoader::~QFactoryLoader() Line 209 C++ Qt5Gui.dll!``anonymous namespace'::Q_QGS_loader::innerFunction'::2'::
dynamic atexit destructor for 'holder''() C++ Qt5Gui.dll!_execute_onexit_table::__l2::() Line 206 C++ Qt5Gui.dll!__crt_seh_guarded_call::operator()<,int (void) &, >(__acrt_lock_and_call::__l2:: && setup={...}, _execute_onexit_table::__l2::int (void) & action=int (void){...}, __acrt_lock_and_call::__l2:: && cleanup={...}) Line 204 C++ Qt5Gui.dll!__acrt_lock_and_call(void) >(const __acrt_lock_id lock_id=__acrt_exit_lock, _execute_onexit_table::__l2::int (void) && action=int (void){...}) Line 912 C++ Qt5Gui.dll!_execute_onexit_table(_onexit_table_t * table=0x0f873798) Line 160 C++ Qt5Gui.dll!common_exit::__l2::() Line 215 C++ Qt5Gui.dll!__crt_seh_guarded_call::operator()<,void (void) &, >(__acrt_lock_and_call::__l2:: && setup={...}, common_exit::__l2::void (void) & action=void (void){...}, __acrt_lock_and_call::__l2:: && cleanup={...}) Line 225 C++ Qt5Gui.dll!__acrt_lock_and_call(void) >(const __acrt_lock_id lock_id=__acrt_exit_lock, common_exit::__l2::void (void) && action=void (void){...}) Line 912 C++ Qt5Gui.dll!common_exit(const int return_code=0, const _crt_exit_cleanup_mode cleanup_mode=_crt_exit_full_cleanup, const _crt_exit_return_mode return_mode=_crt_exit_return_to_caller) Line 263 C++ Qt5Gui.dll!_cexit() Line 298 C++ Qt5Gui.dll!dllmain_crt_process_detach(const bool is_terminating=true) Line 109 C++ Qt5Gui.dll!dllmain_crt_dispatch(HINSTANCE * const instance=0x0f4f0000, const unsigned long reason=0, void * const reserved=0x00000001) Line 134 C++ Qt5Gui.dll!dllmain_dispatch(HINSTANCE__ * const instance=0x0f4f0000, const unsigned long reason=0, void * const reserved=0x00000001) Line 207 C++ Qt5Gui.dll!_DllMainCRTStartup(HINSTANCE__ * const instance=0x0f4f0000, const unsigned long reason=0, void * const reserved=0x00000001) Line 248 C++ ntdll.dll!_LdrpCallInitRoutine@16() Unknown ntdll.dll!_LdrShutdownProcess@0() Unknown ntdll.dll!_RtlExitUserProcess@4() Unknown kernel32.dll!_ExitProcessStub@4() Unknown qt_template.exe!exit_or_terminate_process(const unsigned int return_code) Line 129 C++ qt_template.exe!common_exit(const int return_code=0, const _crt_exit_cleanup_mode cleanup_mode=_crt_exit_full_cleanup, const _crt_exit_return_mode return_mode=_crt_exit_terminate_process) Line 218 C++ qt_template.exe!exit(int return_code=0) Line 282 C++ qt_template.exe!__scrt_common_main_seh() Line 262 C++ kernel32.dll!@BaseThreadInitThunk@12() Unknown ntdll.dll!___RtlUserThreadStart@8() Unknown ntdll.dll!__RtlUserThreadStart@8() Unknown
关于crash - 将QT与带有-MT崩溃的DLL一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39969681/