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

AUTOUIC doesn't detect UI files when include is on the first line

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Invalid
    • Affects Version/s: 5.9.3
    • Fix Version/s: None
    • Component/s: Build tools: uic
    • Labels:
      None
    • Environment:
      OS: macOS High Sierra
      Version 10.13.2
      MacBook Pro (Retina, 13-inch, Early 2015)

      Qt version 5.9.3
      CMake version 3.7.2

      Description

      With following setup:

      CMakeLists.txt

      project("proj")
      
      set(CMAKE_PREFIX_PATH "$ENV{QTDIR}")
      find_package(Qt5Core REQUIRED)
      find_package(Qt5Widgets REQUIRED)
      
      set(CMAKE_INCLUDE_CURRENT_DIR "YES")
      set(CMAKE_AUTOMOC "YES")
      set(CMAKE_AUTOUIC "YES")
      
      add_executable("proj" MACOSX_BUNDLE main.cpp)
      target_link_libraries("proj" Qt5::Core Qt5::Widgets)

       

      form.ui

      <?xml version="1.0" encoding="UTF-8"?>
      <ui version="4.0">
       <class&gt;Form</class&gt;
       <widget class="QWidget" name="Form">
       </widget>
       <resources/>
       <connections/>
      </ui>

       

      main.cpp

      #include "ui_form.h"
      int main() {
      }

       

      I get following error:

      $ cmake --build .
      Scanning dependencies of target proj_automoc
      [ 25%] Automatic moc and uic for target proj
      Generating moc compilation proj_automoc.cpp
      [ 25%] Built target proj_automoc
      Scanning dependencies of target proj
      [ 50%] Building CXX object CMakeFiles/proj.dir/main.cpp.o
      main.cpp:1:10: fatal error: 'ui_form.h' file not found
      #include "ui_form.h"
               ^
      1 error generated.
      make[2]: *** [CMakeFiles/proj.dir/main.cpp.o] Error 1
      make[1]: *** [CMakeFiles/proj.dir/all] Error 2
      make: *** [all] Error 2

       

      However if I move include to the second line everything works

      main.cpp

      
      #include "ui_form.h"
      int main() {
      }

       

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            jkobus Jarek Kobus
            Reporter:
            teivaz Oleksandr Kuznietsov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes