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

Qt6.8.0的llvm版本和gcc版本处理moc文件的include文件路径时出错

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 6.8.0
    • Build System: CMake
    • None
    • Windows11, Qt6.8.0
    • Windows

    Description

      以前都是直接使用MSVC版本, 这是第一次尝试使用MinGW来进行编译产品.

      我定义了一个QWidget, Paging, 然后在另一个QWidget中将一个QWidget提升为Paging.

      这部分代码在使用MSVC的时候一直都是完全正常的. 但是换用了LLVM和GCC之后, 都编译出错. 

          ${CMAKE_CURRENT_SOURCE_DIR}/widgets/paging.cpp
          ${CMAKE_CURRENT_SOURCE_DIR}/widgets/paging.h
          ${CMAKE_CURRENT_SOURCE_DIR}/widgets/paging.ui
          ${CMAKE_CURRENT_SOURCE_DIR}/widgets/sampleform.cpp
          ${CMAKE_CURRENT_SOURCE_DIR}/widgets/sampleform.h
          ${CMAKE_CURRENT_SOURCE_DIR}/widgets/sampleform.ui

      在ui_sampleform.h中是这样的:

      #include <QtCore/QVariant>
      #include <QtWidgets/QApplication>
      #include <QtWidgets/QWidget>
      #include "paging.h"

      QT_BEGIN_NAMESPACE

      class Ui_SampleForm
      {
      public:
          Paging *widget;

       

      编译器会提示 ...atal error: 'paging.h' file not found
         15 | #include "paging.h"

      但是这个代码从Qt5开始在MSVC编译器下就从未出现过问题. 

       

      另外, 我将上述六个文件放到CMakeList.txt根目录下也没有用处. 

       

      Attachments

        1. CMakeLists.txt.user
          55 kB
        2. test.rar
          3 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qtbuildsystem Qt Build System Team
            xuesong xue song
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes