静态链接MSVC库,动态链接Qt

时间:2019-09-11 14:18:11

标签: c++ windows visual-studio qt

我正在部署使用Qt构建的内容,并且由于LGPL而被动态链接。我使用windeployqt.exe来收集必要的dll,并且在Windows 10计算机上运行良好。在Windows 7计算机上尝试时,出现此错误:

  

该程序无法启动,因为您的计算机缺少MSVCP140.dll。

经过一些研究,结果发现MSVCP140.dll是Visual Studio安装的System 32中的dll。我应该让我的客户端安装Visual Studio(在我的情况下这不是一个选择),或者静态链接它。我尝试使用/MT,但得到了:

  

使用/ MD覆盖/ MT

大概是因为如果不静态编译Qt本身就无法静态链接Qt库。 由于LGPL,我想做的是动态链接Qt库,而静态链接MSVC库。有没有办法做到这一点?最好来自Qt创建者。
我认为在程序中包括MSVCP140.dll是不可行的。

我正在使用Visual Studio 2019和Qt 13.1

2 个答案:

答案 0 :(得分:3)

为了使目标计算机运行使用Visual Studio 2015或更高版本构建的软件,您将需要在其上安装最新的MSVC运行时可再发行组件包。某些系统(例如Windows 10)将已经具有最新版本。

您可以从此处获取最新的软件包:vc_redist.XXX.exe,具体取决于目标平台。

选择“静态链接”选项仅适用于MFC库。

关于堆栈溢出,有一个古老的-可能非常有用的问答集here

答案 1 :(得分:1)

正如drescherjm所说,最简单的方法是使用NSIS。 一个简单的脚本可以创建包含所有必需文件的软件包...

我创建了环境变量MSVC_FOLDER,QT_MAJOR_VERSION等,以使此脚本可以与3个版本的Qt(5.5.1、5.8和5.11)和3个版本的Visual Studio(2010、2013和2015)一起使用...

您可以简化所有这一切...

示例脚本:

; Script generated by the HM NIS Edit Script Wizard.

; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "Define name"
!define PRODUCT_VERSION "0.0.0.0"
!define PRODUCT_PUBLISHER "Define..."
!define PRODUCT_WEB_SITE "http://www.define.com.br"
!define PRODUCT_DIR_REGKEY "Software\YourCompany\${PRODUCT_NAME}"
!define PRODUCT_UNINST_KEY "Software\YourCompany\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"

; MUI 1.67 compatible ------
!include "MUI.nsh"

; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"

; Welcome page
!insertmacro MUI_PAGE_WELCOME
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN "$INSTDIR\YourSistem.exe"
!insertmacro MUI_PAGE_FINISH

; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES

; Language files
!insertmacro MUI_LANGUAGE "PortugueseBR"

; MUI end ------

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "\Desenvol\Instaladores\${PRODUCT_NAME}\${PRODUCT_NAME}Setup.exe"
InstallDir "C:\${PRODUCT_NAME}"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show

Section "SeçãoPrincipal" SEC01

  !if /FileExists "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\${PRODUCT_NAME}.exe"
    !cd "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\"
    !system '"C:\Program Files (x86)\$%MSVC_FOLDER%\VC\bin\nmake.exe" /f Makefile clean '

    !cd "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\"
    !system '"C:\Qt\Qt$%QT_MAJOR_VERSION%.$%QT_MINOR_VERSION%.$%QT_REVISION%\$%QT_MAJOR_VERSION%.$%QT_MINOR_VERSION%\$%QT_COMPILER%\bin\windeployqt.exe" --qmldir ..\..\YourSistem\ . -release --no-qmltooling '
    !system 'rmdir /s /q private '
    !system 'rmdir /s /q QtGraphicalEffects '
    !system 'mkdir \Desenvol\Instaladores\${PRODUCT_NAME} '
  !endif

  !cd "${SCRIPT_FOLDER}"

  SetOutPath "$SYSDIR"
  File /nonfatal "C:\Program Files (x86)\$%MSVC_FOLDER%\VC\redist\x86\Microsoft.VC$%MSVC_RUNTIME%.CRT\msvcp$%MSVC_RUNTIME%.dll"
  File /nonfatal "C:\Program Files (x86)\$%MSVC_FOLDER%\VC\redist\x86\Microsoft.VC$%MSVC_RUNTIME%.CRT\msvcr$%MSVC_RUNTIME%.dll"
  SetOutPath "$INSTDIR"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\D3Dcompiler_43.dll"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\Qt5Core.dll"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\Qt5Gui.dll"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\Qt5Qml.dll"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\Qt5Quick.dll"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\Qt5Network.dll"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\Qt5PrintSupport.dll"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\Qt5Sql.dll"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\Qt5Svg.dll"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\Qt5Widgets.dll"

  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\libEGL.dll"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\libGLESV2.dll"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\opengl32sw.dll"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\${PRODUCT_NAME}.exe"
  File /nonfatal "\Desenvol\CPP\${SCRIPT_FOLDER}\*.ini"
  File /nonfatal "\Desenvol\CPP\${SCRIPT_FOLDER}\*.rwf"

  SetOutPath "$INSTDIR\QtQml\Models.2"
  File /nonfatal /r "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\QtQml\Models.2\*.*"

  SetOutPath "$INSTDIR\QtQuick"
  File /nonfatal /r "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\QtQuick\*.*"

  SetOutPath "$INSTDIR\QtQuick.2"
  File /nonfatal /r "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\QtQuick.2\*.*"

  SetOutPath "$INSTDIR\iconengines"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\iconengines\qsvgicon.dll"

  SetOutPath "$INSTDIR\imageformats"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\imageformats\qdds.dll"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\imageformats\qgif.dll"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\imageformats\qicns.dll"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\imageformats\qico.dll"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\imageformats\qjp2.dll"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\imageformats\qjpeg.dll"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\imageformats\qmng.dll"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\imageformats\qsvg.dll"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\imageformats\qtga.dll"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\imageformats\qtiff.dll"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\imageformats\qwbmp.dll"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\imageformats\qwebp.dll"

  SetOutPath "$INSTDIR\platforms"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\platforms\qwindows.dll"

  SetOutPath "$INSTDIR\printsupport"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\printsupport\windowsprintersupport.dll"

  SetOutPath "$INSTDIR\Databases"
  File /nonfatal "\Desenvol\CPP\${PRODUCT_NAME}\Databases\${PRODUCT_NAME}.db"

  SetOutPath "$INSTDIR\sqldrivers"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\sqldrivers\qsqlite.dll"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\sqldrivers\qsqlmysql.dll"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\sqldrivers\qsqlodbc.dll"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\sqldrivers\qsqlpsql.dll"

  SetOutPath "$INSTDIR\translations"
  File /nonfatal "\Desenvol\CPP\${PRODUCT_NAME}\*.qm"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\translations\qt_ca.qm"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\translations\qt_cs.qm"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\translations\qt_de.qm"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\translations\qt_en.qm"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\translations\qt_fi.qm"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\translations\qt_fr.qm"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\translations\qt_he.qm"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\translations\qt_hu.qm"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\translations\qt_it.qm"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\translations\qt_ja.qm"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\translations\qt_ko.qm"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\translations\qt_lv.qm"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\translations\qt_ru.qm"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\translations\qt_sk.qm"
  File /nonfatal "\Desenvol\CPP\build-${PRODUCT_NAME}-Desktop_Qt_$%QT_MAJOR_VERSION%_$%QT_MINOR_VERSION%_$%QT_REVISION%_$%QT_COMPILER%_32bit-Release\release\translations\qt_uk.qm"

gone:

SectionEnd

Section -AdditionalIcons
  SetOutPath $INSTDIR
  WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"

  SetOutPath "$SMPROGRAMS\${PRODUCT_NAME}"
  CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
  CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\uninst.exe"
  CreateShortcut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe"

  CreateShortcut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe"

SectionEnd

Section -Post
  WriteUninstaller "$INSTDIR\uninst.exe"
  WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\${PRODUCT_NAME}.exe"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\AppMainExe.exe"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd


Function un.onUninstSuccess
  HideWindow
  MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) foi removido com sucesso do seu computador."
FunctionEnd

Function un.onInit
  MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Tem certeza que quer remover completamente $(^Name) e todos os seus componentes?" IDYES +2
  Abort
FunctionEnd

Function .onInit
    System::Call 'kernel32::CreateMutex(p 0, i 0, t "myMutex") p .r1 ?e'
     Pop $R0

     StrCmp $R0 0 +3
       MessageBox MB_OK|MB_ICONEXCLAMATION "O instalador já está em execução."
       Abort
FunctionEnd

Section Uninstall
  Delete "$INSTDIR\${PRODUCT_NAME}.url"
  Delete "$INSTDIR\uninst.exe"
  Delete "$INSTDIR\translations\qt_uk.qm"
  Delete "$INSTDIR\translations\qt_sk.qm"
  Delete "$INSTDIR\translations\qt_ru.qm"
  Delete "$INSTDIR\translations\qt_lv.qm"
  Delete "$INSTDIR\translations\qt_ko.qm"
  Delete "$INSTDIR\translations\qt_ja.qm"
  Delete "$INSTDIR\translations\qt_it.qm"
  Delete "$INSTDIR\translations\qt_hu.qm"
  Delete "$INSTDIR\translations\qt_he.qm"
  Delete "$INSTDIR\translations\qt_fr.qm"
  Delete "$INSTDIR\translations\qt_fi.qm"
  Delete "$INSTDIR\translations\qt_en.qm"
  Delete "$INSTDIR\translations\qt_de.qm"
  Delete "$INSTDIR\translations\qt_cs.qm"
  Delete "$INSTDIR\translations\qt_ca.qm"
  Delete "$INSTDIR\sqldrivers\qsqlpsql.dll"
  Delete "$INSTDIR\sqldrivers\qsqlodbc.dll"
  Delete "$INSTDIR\sqldrivers\qsqlmysql.dll"
  Delete "$INSTDIR\sqldrivers\qsqlite.dll"
  Delete "$INSTDIR\Qt5Widgets.dll"
  Delete "$INSTDIR\Qt5Svg.dll"
  Delete "$INSTDIR\Qt5Sql.dll"
  Delete "$INSTDIR\Qt5PrintSupport.dll"
  Delete "$INSTDIR\Qt5Network.dll"
  Delete "$INSTDIR\Qt5Gui.dll"
  Delete "$INSTDIR\Qt5Core.dll"
  Delete "$INSTDIR\Qt5Qml.dll"
  Delete "$INSTDIR\Qt5Quick.dll"
  Delete "$INSTDIR\opengl32sw.dll"
  Delete "$INSTDIR\libGLESV2.dll"
  Delete "$INSTDIR\libEGL.dll"
  Delete "$INSTDIR\printsupport\windowsprintersupport.dll"
  Delete "$INSTDIR\platforms\qwindows.dll"
  Delete "$INSTDIR\imageformats\qwebp.dll"
  Delete "$INSTDIR\imageformats\qwbmp.dll"
  Delete "$INSTDIR\imageformats\qtiff.dll"
  Delete "$INSTDIR\imageformats\qtga.dll"
  Delete "$INSTDIR\imageformats\qsvg.dll"
  Delete "$INSTDIR\imageformats\qmng.dll"
  Delete "$INSTDIR\imageformats\qjpeg.dll"
  Delete "$INSTDIR\imageformats\qjp2.dll"
  Delete "$INSTDIR\imageformats\qico.dll"
  Delete "$INSTDIR\imageformats\qicns.dll"
  Delete "$INSTDIR\imageformats\qgif.dll"
  Delete "$INSTDIR\imageformats\qdds.dll"
  Delete "$INSTDIR\iconengines\qsvgicon.dll"
  Delete "$INSTDIR\Databases\SisMega.db"
  Delete "$INSTDIR\D3Dcompiler_43.dll"
  Delete "$INSTDIR\bearer\qnativewifibearer.dll"
  Delete "$INSTDIR\bearer\qgenericbearer.dll"

  Delete "$INSTDIR\*.ini"
  Delete "$INSTDIR\*.log"
  Delete "$INSTDIR\*.rwf"
  Delete "$INSTDIR\*.html*"
  Delete "$INSTDIR\*.map"
  Delete "$INSTDIR\*.tsk"
  Delete "$INSTDIR\${PRODUCT_NAME}.exe"

  Delete "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk"
  Delete "$SMPROGRAMS\${PRODUCT_NAME}\Website.lnk"
  Delete "$DESKTOP\${PRODUCT_NAME}.lnk"
  Delete "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk"

  RMDir "$SMPROGRAMS\${PRODUCT_NAME}"
  RMDir /r "$INSTDIR\translations"
  RMDir /r "$INSTDIR\sqldrivers"
  RMDir /r "$INSTDIR\printsupport"
  RMDir /r "$INSTDIR\platforms"
  RMDir /r "$INSTDIR\imageformats"
  RMDir /r "$INSTDIR\iconengines"
  RMDir /r "$INSTDIR\Databases"
  RMDir /r "$INSTDIR\bearer"
  RMDir /r "$INSTDIR\QtQml"
  RMDir /r "$INSTDIR\QtQuick"
  RMDir /r "$INSTDIR\QtQuick.2"
  RMDir "$INSTDIR"

  DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
  DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
  SetAutoClose true
SectionEnd