• qt vc打包编译注意事项


    项目配置中,选择MSVC2015 32位版本,64位库有些不好找,32位比较保险,后期不麻烦

    选这个编译器,要安装MSVC2015编译器,最快的办法就是安装VS2015.

    编译报错,找不到头文件 ,修改如下

    然后把用windeployqt + name.exe  工具把相关的依赖库复制到exe目录下,再把msvc相关的库拷贝到目录下。

     这样放到没有MSVC的环境中也能正常运行。代码如下

    QT       += core gui
     
    
    #[1] add serialport
    QT += serialport serialbus
    QT += sql
     
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
     
    
    CONFIG += c++11
     
    
    # The following define makes your compiler emit warnings if you use
    # any Qt feature that has been marked deprecated (the exact warnings
    # depend on your compiler). Please consult the documentation of the
    # deprecated API in order to know how to port your code away from it.
    DEFINES += QT_DEPRECATED_WARNINGS
     
    
    INCLUDEPATH += "C:/Program Files (x86)/Windows Kits/10/Include/10.0.10240.0/ucrt"
    LIBS += -L"C:/Program Files (x86)/Windows Kits/10/Lib/10.0.10240.0/ucrt/x86"
     
    
    # You can also make your code fail to compile if it uses deprecated APIs.
    # In order to do so, uncomment the following line.
    # You can also select to disable deprecated APIs only up to a certain version of Qt.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
     
    
    SOURCES += \
        main.cpp \
        mainwindow.cpp \
        myComboBox.cpp \
        modbusmng.cpp \
        bottommng.cpp \
        dialoginputpw.cpp \
        dialogchangepw.cpp \
        logmng.cpp
     
    
    HEADERS += \
        mainwindow.h \
        myComboBox.h \
        modbusmng.h \
        fundef.h \
        bottommng.h \
        dialoginputpw.h \
        dialogchangepw.h \
        logmng.h
     
    
    FORMS += \
        mainwindow.ui \
        dialoginputpw.ui \
        dialogchangepw.ui
     
    
    # Default rules for deployment.
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target
     
    
    DISTFILES += \
        helptf \
        readme
     
    
    RESOURCES += \
        image.qrc
     
    

     

     

  • 相关阅读:
    Java概述
    Java解析生成二维码
    Sql语句的执行流程
    【全开源】Java无人共享棋牌室茶室台球室系统JAVA版本支持微信小程序+微信公众号
    Java使用正则表达式判断独立字符的存在
    Keeplived练习
    学术论文写作
    -带你看懂11种API类型及应用-
    OPCHDA接口
    AOP切入点表达式
  • 原文地址:https://blog.csdn.net/scutedu/article/details/125633098