Project ERROR: msvc-version.conf loaded but QMAKE_MSC_VER isn‘t set

  • 客户端demo是qt的
  • 使用qt的vs插件,导入pro文件为sln
  • Project ERROR: msvc-version.conf loaded but QMAKE_MSC_VER isn’t set

很多人说删除构建目录,删除stash文件

  • 不管用
  • pro文件导出为sln的时候,会自动升成一个文件 .qmake.stash
QMAKE_CXX.QT_COMPILER_STDCXX = 199711L
QMAKE_CXX.QMAKE_MSC_VER = 1927
QMAKE_CXX.QMAKE_MSC_FULL_VER = 192729111
QMAKE_CXX.COMPILER_MACROS = \
    QT_COMPILER_STDCXX \
    QMAKE_MSC_VER \
    QMAKE_MSC_FULL_VER
QMAKE_CXX.INCDIRS = \
    "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.27.29110\\ATLMFC\\include" \
    "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.27.29110\\include" \
    "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\ucrt" \
    "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\shared" \
    "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\um" \
    "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\winrt" \
    "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\cppwinrt"
QMAKE_CXX.LIBDIRS = \
    "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.27.29110\\ATLMFC\\lib\\x86" \
    "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.27.29110\\lib\\x86" \
    "C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.18362.0\\ucrt\\x86" \
    "C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.18362.0\\um\\x86"

vs的qt插件导入pro工程为sln

  • 导入立即报错:

== Qt Visual Studio Tools version 2.6.0

   Initialized in: 988.18 msecs
   Main (UI) thread: 675.39 msecs

--- (Import): Generating new project of zhangbinrtc-client-windows.pro file
--- (qmake) : Working Directory: D:\nd-dev\zhangbinrtc-client-sdk\zhangbinrtc-client-ui
--- (qmake) : Arguments:  QMAKE_INCDIR_QT=$(QTDIR)\include QMAKE_LIBDIR=$(QTDIR)\lib QMAKE_MOC=$(QTDIR)\bin\moc.exe QMAKE_QMAKE=$(QTDIR)\bin\qmake.exe -tp vc -recursive "zhangbinrtc-client-windows.pro"

--- (qmake) : Using: D:\QT\QT5.13.2\5.13.2\MSVC2017\bin\qmake.exe
Info: creating stash file D:\nd-dev\zhangbinrtc-client-sdk\zhangbinrtc-client-ui\.qmake.stash
Reading D:/nd-dev/zhangbinrtc-client-sdk/zhangbinrtc-client-ui/zhangbinrtc-client/zhangbinrtc-client.pro
Reading D:/nd-dev/zhangbinrtc-client-sdk/zhangbinrtc-client-ui/framework/framework.pro
Reading D:/nd-dev/zhangbinrtc-client-sdk/zhangbinrtc-client-ui/client-ui-sdk/client-ui-sdk.pro
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_icon_checkbox_checked.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_icon_checkbox_hover.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_icon_checkbox_disable.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_popup_sound_white.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_popup_sound_green.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general__icon_checkbox.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_icon_checkbox_hover.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_icon_checkbox_disable.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_icon_checkbox_checked.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general__icon_checkbox.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_popup_sound_white.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_popup_sound_green.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_icon_checkbox_checked.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general__icon_checkbox.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_popup_sound_green.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_icon_checkbox_disable.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_icon_checkbox_hover.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_popup_sound_white.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_icon_checkbox_disable.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_icon_checkbox_hover.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general__icon_checkbox.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_icon_checkbox_checked.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_popup_sound_white.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_popup_sound_green.png'
Reading D:/nd-dev/zhangbinrtc-client-sdk/zhangbinrtc-client-ui/client-service-sdk/client-service-sdk.pro
Reading D:/nd-dev/zhangbinrtc-client-sdk/zhangbinrtc-client-ui/third-party/third-party.pro
Project ERROR: msvc-version.conf loaded but QMAKE_MSC_VER isn't set

  • 在这里插入图片描述
  • 看了下,这个 环境变量确实没有
  • 加入 QMAKE_MSC_VER=1900
#
# qmake configuration for Microsoft Visual Studio C/C++ Compiler
# This file is used by win32-msvc and all winrt-XXX-msvcXXX specs
#

#
# Version-specific changes
#
QMAKE_MSC_VER=1900
isEmpty(QMAKE_MSC_VER): error("msvc-version.conf loaded but QMAKE_MSC_VER isn't set")

MSVC_VER = 8.0
COMPAT_MKSPEC = win32-msvc2005

greaterThan(QMAKE_MSC_VER, 1499) {
    # Visual Studio 2008 (9.0) / Visual C++ 15.0 and up
    MSVC_VER            = 9.0
    COMPAT_MKSPEC       = win32-msvc2008
    QMAKE_CFLAGS_MP     = -MP
    QMAKE_CXXFLAGS_MP   = $$QMAKE_CFLAGS_MP
}

greaterThan(QMAKE_MSC_VER, 1599) {
    # Visual Studio 2010 (10.0) / Visual C++ 16.0 and up
    MSVC_VER            = 10.0
    COMPAT_MKSPEC       = win32-msvc2010
    MAKEFILE_GENERATOR  = MSBUILD

    QMAKE_CFLAGS_AVX    = -arch:AVX
    QMAKE_CFLAGS_AVX2   = -arch:AVX

    VCPROJ_EXTENSION    = .vcxproj
}

greaterThan(QMAKE_MSC_VER, 1699) {
    # Visual Studio 2012 (11.0) / Visual C++ 17.0 and up
    MSVC_VER            = 11.0
    COMPAT_MKSPEC       = win32-msvc2012
    QMAKE_CXXFLAGS_EXCEPTIONS_OFF = /wd4530 /wd4577
    QT_CONFIG          += c++11
    CONFIG             += c++11
}

greaterThan(QMAKE_MSC_VER, 1799) {
    # Visual Studio 2013 (12.0) / Visual C++ 18.0 and up
    MSVC_VER            = 12.0
    COMPAT_MKSPEC       = win32-msvc2013
    QMAKE_CFLAGS       += -FS
    QMAKE_CXXFLAGS     += -FS -Zc:rvalueCast -Zc:inline

    QMAKE_CFLAGS_F16C   = -arch:AVX
    QMAKE_CFLAGS_RDRND  =

    equals(QMAKE_MSC_VER, 1800) {
        QMAKE_CFLAGS_RELEASE += -Zc:strictStrings
        QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -Zc:strictStrings
        QMAKE_CXXFLAGS_RELEASE += -Zc:strictStrings
        QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += -Zc:strictStrings
    }
}

greaterThan(QMAKE_MSC_VER, 1899) {
    # Visual Studio 2015 (14.0) / Visual C++ 19.0 and up
    MSVC_VER            = 14.0
    COMPAT_MKSPEC       = win32-msvc2015
    QMAKE_CFLAGS       += -Zc:strictStrings
    QMAKE_CFLAGS_WARN_ON += -w44456 -w44457 -w44458
    QMAKE_CFLAGS_AVX2   = -arch:AVX2
    QMAKE_CXXFLAGS     += -Zc:strictStrings -Zc:throwingNew
    QMAKE_CXXFLAGS_WARN_ON += -w44456 -w44457 -w44458 -wd4577 -wd4467

    # -utf-8 compiler option for Visual Studio 2015 Update 2
    greaterThan(QMAKE_MSC_FULL_VER, 190023918): QMAKE_CFLAGS_UTF8_SOURCE = -utf-8
}

greaterThan(QMAKE_MSC_VER, 1909) {
    # Visual Studio 2017 (15.0) / Visual C++ 19.10 and up
    MSVC_VER            = 15.0
    COMPAT_MKSPEC       = win32-msvc2017
    QMAKE_CXXFLAGS     += -Zc:referenceBinding

    # Only Visual Studio 2017 version 15.3 / Visual C++ 19.11 & up have support
    # for AVX-512. We enable the switches anyway and let configure check if they
    # work.
    QMAKE_CFLAGS_AVX512F   = -arch:AVX512
    QMAKE_CFLAGS_AVX512ER  = -arch:AVX512
    QMAKE_CFLAGS_AVX512CD  = -arch:AVX512
    QMAKE_CFLAGS_AVX512PF  = -arch:AVX512
    QMAKE_CFLAGS_AVX512DQ  = -arch:AVX512
    QMAKE_CFLAGS_AVX512BW  = -arch:AVX512
    QMAKE_CFLAGS_AVX512VL  = -arch:AVX512
    QMAKE_CFLAGS_AVX512IFMA = -arch:AVX512
    QMAKE_CFLAGS_AVX512VBMI = -arch:AVX512

    # For now permissive fails as soon as UWP API comes into play. In qtbase this
    # API is used in direct2d, but also in multimedia, positioning and sensors.
    # We can try again with a later version of Visual Studio.
    # QMAKE_CXXFLAGS_STRICTCXX = -permissive-

    # MSVC partially supports the following, but '__cplusplus' definition is set
    # as for C++98 until MSVC fully conforms with C++14, see
    # https://developercommunity.visualstudio.com/content/problem/139261/msvc-incorrectly-defines-cplusplus.html
    # Support became available in MSVC 2017 15.7:
    greaterThan(QMAKE_MSC_VER, 1913) {
        QMAKE_CXXFLAGS      += -Zc:__cplusplus
        QMAKE_CXXFLAGS_CXX14 = -std:c++14
        QMAKE_CXXFLAGS_CXX1Z = -std:c++17
    }
}

greaterThan(QMAKE_MSC_VER, 1910) {
    # No compat spec past MSVC 2017
    COMPAT_MKSPEC       =
}

greaterThan(QMAKE_MSC_VER, 1919) {
    # Visual Studio 2019 (16.0) / Visual C++ 19.20 and up
    MSVC_VER            = 16.0
    QMAKE_CXXFLAGS_CXX2A = -std:c++latest

}

!isEmpty(COMPAT_MKSPEC):!$$COMPAT_MKSPEC: CONFIG += $$COMPAT_MKSPEC

  • 因为我的qt5.13和5.14都只有msvc2017的32和64构建支持,所以尽管我用vs2019,但是我还是选用了msvc2017 工具链 以与qt搭配。。
  • 实际激活了在这个:
greaterThan(QMAKE_MSC_VER, 1909) {
    # Visual Studio 2017 (15.0) / Visual C++ 19.10 and up
    MSVC_VER            = 15.0
    COMPAT_MKSPEC       = win32-msvc2017
    QMAKE_CXXFLAGS     += -Zc:referenceBinding

    # Only Visual Studio 2017 version 15.3 / Visual C++ 19.11 & up have support
    # for AVX-512. We enable the switches anyway and let configure check if they
    # work.
    QMAKE_CFLAGS_AVX512F   = -arch:AVX512
    QMAKE_CFLAGS_AVX512ER  = -arch:AVX512
    QMAKE_CFLAGS_AVX512CD  = -arch:AVX512
    QMAKE_CFLAGS_AVX512PF  = -arch:AVX512
    QMAKE_CFLAGS_AVX512DQ  = -arch:AVX512
    QMAKE_CFLAGS_AVX512BW  = -arch:AVX512
    QMAKE_CFLAGS_AVX512VL  = -arch:AVX512
    QMAKE_CFLAGS_AVX512IFMA = -arch:AVX512
    QMAKE_CFLAGS_AVX512VBMI = -arch:AVX512

    # For now permissive fails as soon as UWP API comes into play. In qtbase this
    # API is used in direct2d, but also in multimedia, positioning and sensors.
    # We can try again with a later version of Visual Studio.
    # QMAKE_CXXFLAGS_STRICTCXX = -permissive-

    # MSVC partially supports the following, but '__cplusplus' definition is set
    # as for C++98 until MSVC fully conforms with C++14, see
    # https://developercommunity.visualstudio.com/content/problem/139261/msvc-incorrectly-defines-cplusplus.html
    # Support became available in MSVC 2017 15.7:
    greaterThan(QMAKE_MSC_VER, 1913) {
        QMAKE_CXXFLAGS      += -Zc:__cplusplus
        QMAKE_CXXFLAGS_CXX14 = -std:c++14
        QMAKE_CXXFLAGS_CXX1Z = -std:c++17
    }
}
  • 这样就没有再报错了
== Qt Visual Studio Tools version 2.6.0

   Initialized in: 1375.06 msecs
   Main (UI) thread: 619.04 msecs

--- (Import): Generating new project of zhangbinrtc-client-windows.pro file
--- (qmake) : Arguments:  QMAKE_INCDIR_QT=$(QTDIR)\include QMAKE_LIBDIR=$(QTDIR)\lib QMAKE_MOC=$(QTDIR)\bin\moc.exe QMAKE_QMAKE=$(QTDIR)\bin\qmake.exe -tp vc -recursive "zhangbinrtc-client-windows.pro"

--- (qmake) : Using: D:\QT\QT5.13.2\5.13.2\MSVC2017\bin\qmake.exe
--- (qmake) : Working Directory: D:\nd-dev\zhangbinrtc-client-sdk\zhangbinrtc-client-ui
Reading D:/nd-dev/zhangbinrtc-client-sdk/zhangbinrtc-client-ui/zhangbinrtc-client/zhangbinrtc-client.pro
Reading D:/nd-dev/zhangbinrtc-client-sdk/zhangbinrtc-client-ui/framework/framework.pro
Reading D:/nd-dev/zhangbinrtc-client-sdk/zhangbinrtc-client-ui/client-ui-sdk/client-ui-sdk.pro
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_icon_checkbox_checked.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_icon_checkbox_disable.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_icon_checkbox_hover.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_popup_sound_green.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_popup_sound_white.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general__icon_checkbox.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_icon_checkbox_checked.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_icon_checkbox_disable.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_icon_checkbox_hover.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general__icon_checkbox.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_popup_sound_green.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_popup_sound_white.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_icon_checkbox_hover.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_icon_checkbox_disable.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_icon_checkbox_checked.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general__icon_checkbox.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_popup_sound_green.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_popup_sound_white.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_icon_checkbox_checked.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_icon_checkbox_hover.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general__icon_checkbox.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_icon_checkbox_disable.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_popup_sound_green.png'
ui\zhangbinrtc-client.qrc: Warning: potential duplicate alias detected: 'general_popup_sound_white.png'
Reading D:/nd-dev/zhangbinrtc-client-sdk/zhangbinrtc-client-ui/client-service-sdk/client-service-sdk.pro
Reading D:/nd-dev/zhangbinrtc-client-sdk/zhangbinrtc-client-ui/third-party/third-party.pro
 Reading D:/nd-dev/zhangbinrtc-client-sdk/zhangbinrtc-client-ui/third-party/libgitlevtbus/src/EventBus.pro
--- (Import): Finished opening zhangbinrtc-client-windows.sln

上面会出现工具链不对的问题

  • 首先,会默认选我装的最新的windows sdk版本
  • 工具链 会用vs2015,
  • 本着钻研精神,我重新装了一个qt5.14.2
  • 然后32位的目录再配置了一次,这次就用1919
  • 在这里插入图片描述
  • 激活了这个
greaterThan(QMAKE_MSC_VER, 1919) {
    # Visual Studio 2019 (16.0) / Visual C++ 19.20 and up
    MSVC_VER            = 16.0
    QMAKE_CXXFLAGS_CXX2A = -std:c++latest

}

这次就设置对了,vs2019 捋顺了

  • 在这里插入图片描述

加入1919以后,Qt工程就ok了

  • D:\nd-dev\demo\OpenLive-Demo-on-Qt

== Qt Visual Studio Tools version 2.6.0 (rev.7)

   Initialized in: 178.34 msecs
   Main (UI) thread: 36.82 msecs

--- qmake(21292): started D:\QT\QT5.14.2\5.14.2\MSVC2017\bin\qmake.exe
--- qmake: Querying persistent properties
--- qmake(21292): exit code 0 (56.88 msecs)

--- qmake: Working Directory: C:\Users\zhangbin\AppData\Local\Temp\xqfftxib.bkw
--- qmake(21792): started D:\QT\QT5.14.2\5.14.2\MSVC2017\bin\qmake.exe
--- qmake: Arguments:  QMAKE_INCDIR_QT=$(QTDIR)\include QMAKE_LIBDIR=$(QTDIR)\lib QMAKE_MOC=$(QTDIR)\bin\moc.exe QMAKE_QMAKE=$(QTDIR)\bin\qmake.exe -o "xqfftxib.bkw.vcxproj" -tp vc -Wnone "xqfftxib.bkw.pro"
Info: creating stash file C:\Users\zhangbin\AppData\Local\Temp\xqfftxib.bkw\.qmake.stash
--- qmake(21792): exit code 0 (416.76 msecs)

--- (Import): Generating new project of OpenLive.pro file
--- qmake(28956): started D:\QT\QT5.14.2\5.14.2\MSVC2017\bin\qmake.exe
--- qmake: Arguments:  QMAKE_INCDIR_QT=$(QTDIR)\include QMAKE_LIBDIR=$(QTDIR)\lib QMAKE_MOC=$(QTDIR)\bin\moc.exe QMAKE_QMAKE=$(QTDIR)\bin\qmake.exe -o "OpenLive.vcxproj" -tp vc "OpenLive.pro"
--- qmake: Working Directory: D:\nd-dev\demo\OpenLive-Demo-on-Qt
Info: creating stash file D:\nd-dev\demo\OpenLive-Demo-on-Qt\.qmake.stash
--- qmake(28956): exit code 0 (955.29 msecs)

--- (Import): Added OpenLive.vcxproj to Solution

相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页
实付 29.90元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值