Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-61357

VS2017使用Qt5.9.0静态库编译的应用的Debug版本无法运行

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • 5.9.0
    • Extras: Win
    • None
    • VS2017 Qt5.9.0_x64

    Description

      使用VS2017编译的Qt5.9.0_x64静态库.

      当应用链接Qt5.9.0_x64静态库的Debug版本时,能够正常链接.但是无法运行.

      当链接Qt5.9.0_x64静态库的Release版本时,能够正常链接,能够正常运行.

      使用VS2017编译Qt5.9.0_x64_static 库的配置参数为:
      -prefix d:\Qt\Qt5.9.0_x64_static_msvc2017
      -opensource
      -debug-and-release
      -static
      -opengl dynamic
      -nomake examples
      -sql-sqlite
      -mp
      
      使用CMake3.8.0与VS2017编译Qt应用的CMakeList.txt文件内容为:
      
      cmake_minimum_required(VERSION 3.0.0)
      
      set(CMAKE_PREFIX_PATH D:/Qt/Qt5.9.0_x64_static_msvc2017)
      set(CMAKE_CXX_STANDARD 11)
      
      project(qt590static_test)
      
      set(CMAKE_INCLUDE_CURRENT_DIR ON)
      set(CMAKE_AUTOMOC ON)
      
      find_package(Qt5Widgets)
      
      set(QLIBDIR "D:/Qt/Qt5.9.0_x64_static_msvc2017/lib/")
      set(QPLADIR "D:/Qt/Qt5.9.0_x64_static_msvc2017/plugins/platforms/")
      
      if(CMAKE_BUILD_TYPE STREQUAL Debug)
      	set(QLIBS 
      	${QLIBDIR}Qt5PlatformCompositorSupportd.lib
      	${QLIBDIR}Qt5FontDatabaseSupportd.lib
      	${QLIBDIR}Qt5ThemeSupportd.lib
      	${QLIBDIR}Qt5AccessibilitySupportd.lib
      	${QLIBDIR}Qt5EventDispatcherSupportd.lib
      	${QLIBDIR}qtlibpngd.lib
      	${QLIBDIR}qtfreetyped.lib
      	${QLIBDIR}qtpcre2d.lib
      	${QLIBDIR}qtharfbuzzd.lib
      
      	${QPLADIR}qminimald.lib
      	${QPLADIR}qoffscreend.lib
      	${QPLADIR}qwindowsd.lib
      	${QPLADIR}qdirect2dd.lib
      	)
      elseif(CMAKE_BUILD_TYPE STREQUAL Release)
          set(QLIBS 
      	${QLIBDIR}Qt5PlatformCompositorSupport.lib
      	${QLIBDIR}Qt5FontDatabaseSupport.lib
      	${QLIBDIR}Qt5ThemeSupport.lib
      	${QLIBDIR}Qt5AccessibilitySupport.lib
      	${QLIBDIR}Qt5EventDispatcherSupport.lib
      	${QLIBDIR}qtlibpng.lib
      	${QLIBDIR}qtfreetype.lib
      	${QLIBDIR}qtpcre2.lib
      	${QLIBDIR}qtharfbuzz.lib
      
      	${QPLADIR}qminimal.lib
      	${QPLADIR}qoffscreen.lib
      	${QPLADIR}qwindows.lib
      	${QPLADIR}qdirect2d.lib
      	)
      else(CMAKE_BUILD_TYPE STREQUAL Debug)
          message(FATAL_ERROR "please set CMAKE_BUILD_TYPE = Debug | Release")
      endif(CMAKE_BUILD_TYPE STREQUAL Debug)
      
      qt5_wrap_ui(ui_qt590static_test.h qt590static_test.ui)
      
      add_executable(qt590static_test WIN32 main.cpp qt590static_test.cpp qt590static_test.ui)
      
      target_link_libraries(
      	qt590static_test 
      	Qt5::Widgets
      	${QLIBS}
      	imm32.lib
      	winmm.lib
      	Dwmapi.lib
      	UxTheme.lib
      	Mincore.lib
      	version.lib
      	ws2_32.lib
      	)
      

      Attachments

        1. 2.JPG
          2.JPG
          37 kB
        2. 1.JPG
          1.JPG
          38 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kleint Friedemann Kleint
            tangjing 晶 唐
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes