Qt5.12.1将编译器从MinGW更改为MSVC时,QT_配置(未来)将中断

Qt5.12.1将编译器从MinGW更改为MSVC时,QT_配置(未来)将中断,qt,qt5,Qt,Qt5,main.cpp #include "mainwindow.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); } #包括“mainwindow.h” #包括 int main(int argc,char*argv[]) {

main.cpp

#include "mainwindow.h"
#include <QApplication>

int main(int argc, char *argv[])
{
      QApplication a(argc, argv);
      MainWindow w;
      w.show();

      return a.exec();
}
#包括“mainwindow.h”
#包括
int main(int argc,char*argv[])
{
质量保证申请a(argc、argv);
主窗口w;
w、 show();
返回a.exec();
}
main window.h

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

namespace Ui {
    class MainWindow;
}

class MainWindow : public QMainWindow
{
   Q_OBJECT

   public:
   explicit MainWindow(QWidget *parent = nullptr);
   ~MainWindow();

    private:
    Ui::MainWindow *ui;
    };

#endif // MAINWINDOW_H
\ifndef主窗口
#定义主窗口
#包括
名称空间用户界面{
类主窗口;
}
类主窗口:公共QMainWindow
{
Q_对象
公众:
显式主窗口(QWidget*parent=nullptr);
~main窗口();
私人:
Ui::MainWindow*Ui;
};
#endif//main窗口
使用MinGW 64位进行编译时,一切正常。
清除所有项目,将编译器切换到MSVC2017 64位,QtCreator无法识别任何以main.cpp中第一个QApplication开头的Qt类。
经过调查,我在qmainwindow.h中发现:QT_CONFIG(future)导致预处理器表达式被零除。
qmainwindow.h中的一个示例:

#ifndef QDYNAMICMAINWINDOW_H
#define QDYNAMICMAINWINDOW_H 

#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
#if QT_CONFIG(tabwidget)    <-------- this line is grayed out and error is: division by zero in preprocessor expression. Warning is QT_FEATURE_tabwidget is not defined, evaluates to 0
#include <QtWidgets/qtabwidget.h>     <--------- this line is grayed out also
#endif
\ifndef qdynamicmain窗口
#定义QDynamicMain窗口
#包括
#包括

#如果QT_CONFIG(tabwidget)出现问题,MSVC QT工具包就会出现问题。QtCreator配置中该套件上没有警告图标?您是否尝试过重新安装套件?您正在使用哪个构建系统?您可能还需要发布相应的配置(project.pro或CMakeLists.txt)。通常在项目包之间切换“只是工作而已”。@Maxim Paperno->你让我以这种方式进行深入调查。事实上,安装Qt的PC是Windows Server 2012,其中Visual Studio 2017由系统管理员安装,而Qt由非系统管理员帐户安装。当我切换到系统管理员帐户并启动Qt时,所有环境变量都设置正确,特别是与VS路径和Windows SDK路径(约6或7个环境变量)以及MSVC和MinGW上的项目构建相关的变量。当我返回到非amin帐户并启动Qt时,所有变量、VS路径和Windows SDK要么设置为错误值,要么设置为非错误值。。。。。设置,这会导致MSVC找不到其包含目录或库路径。MSVC Qt工具包似乎有问题。QtCreator配置中该套件上没有警告图标?您是否尝试过重新安装套件?您正在使用哪个构建系统?您可能还需要发布相应的配置(project.pro或CMakeLists.txt)。通常在项目包之间切换“只是工作而已”。@Maxim Paperno->你让我以这种方式进行深入调查。事实上,安装Qt的PC是Windows Server 2012,其中Visual Studio 2017由系统管理员安装,而Qt由非系统管理员帐户安装。当我切换到系统管理员帐户并启动Qt时,所有环境变量都设置正确,特别是与VS路径和Windows SDK路径(约6或7个环境变量)以及MSVC和MinGW上的项目构建相关的变量。当我返回到非amin帐户并启动Qt时,所有变量、VS路径和Windows SDK要么设置为错误值,要么设置为非错误值。。。。。设置,这会导致MSVC找不到其包含目录或库路径。
#define QT_CONFIG(feature) (1/QT_FEATURE_##feature == 1)  <--- this causes the /0.
#define QT_FEATURE_tablewidget 1
#define QT_FEATURE_tabwidget 1    <----------- tabwidget is defined as it should be (1 not 0)
#define QT_FEATURE_textbrowser 1
#define QT_FEATURE_toolbar 1