将QT与使用-MT崩溃编译的DLL一起使用

时间:2016-10-11 02:34:06

标签: crash shared qt5.7 mt

我使用-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;
};

一切正常,但是当离开主要功能时,它崩溃了:

[enter image description here][1]

任何人都会帮助我?

1 个答案:

答案 0 :(得分:0)

[enter image description here][1]

ntdll.dll!_RtlFreeHeap@12()未知     kernel32.dll!_HeapFree@12()未知

  

qwindows.dll!_free_base(void * block = 0x00425dc0)第112行C ++       qwindows.dll!free(void * block = 0x00425dc0)第30行C ++       qwindows.dll!operator delete(void * block = 0x00425dc0,unsigned int formal = 8)第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::标量删除析构函数'(unsigned int)C ++       Qt5Core.dll!QObject :: ~QObject()第1049行C ++       Qt5Core.dll!QFactoryLoader :: ~QFactoryLoader()第209行C ++       Qt5Gui.dll!``anonymous namespace':: Q_QGS_loader :: innerFunction':: 2'::动态atexit析构函数'holder''()C ++       Qt5Gui.dll!_execute_onexit_table :: __ l2::()第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 = {...})第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){...})第912行C ++       Qt5Gui.dll!_execute_onexit_table(_onexit_table_t * table = 0x0f873798)第160行C ++       Qt5Gui.dll!common_exit :: __ l2 :: (()第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 = {...})第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){...})第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)第263行C ++       Qt5Gui.dll!_cexit()第298行C ++       Qt5Gui.dll!dllmain_crt_process_detach(const bool is_terminating = true)第109行C ++       Qt5Gui.dll!dllmain_crt_dispatch(HINSTANCE * const instance = 0x0f4f0000,const unsigned long reason = 0,void * const reserved = 0x00000001)第134行C ++       Qt5Gui.dll!dllmain_dispatch(HINSTANCE__ * const instance = 0x0f4f0000,const unsigned long reason = 0,void * const reserved = 0x00000001)第207行C ++       Qt5Gui.dll!_DllMainCRTStartup(HINSTANCE __ const instance = 0x0f4f0000,const unsigned long reason = 0,void * const reserved = 0x00000001)第248行C ++       ntdll.dll!_LdrpCallInitRoutine@16()未知       ntdll.dll!_LdrShutdownProcess@0()未知       ntdll.dll!_RtlExitUserProcess@4()未知       kernel32.dll!_ExitProcessStub@4()未知       qt_template.exe!exit_or_terminate_process(const unsigned int return_code)第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)第218行C ++       qt_template.exe!exit(int return_code = 0)第282行C ++       qt_template.exe!__ scrt_common_main_seh()第262行C ++       kernel32.dll!@ BaseThreadInitThunk @ 12()未知       ntdll.dll!___ RtlUserThreadStart @ 8()未知       ntdll.dll!__ RtlUserThreadStart @ 8()未知