Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Build problem: can't find include file
Forum Updated to NodeBB v4.3 + New Features

Build problem: can't find include file

Scheduled Pinned Locked Moved Solved General and Desktop
13 Posts 5 Posters 816 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A atrink

    Hello!
    I created a customer widget.
    In mainwindows.ui I created a QFrame as placeholder for this customer widget.
    The class is called TabEditor and the include file is tabeditor.h.

    When compiling I get an error:
    /home/atrink/src/testplatzhalter4/build/Desktop_Qt_6_7_0-Debug/testplatzhalter4_autogen/include/ui_mainwindow.h:23: Fehler: tabeditor.h: No such file or directory
    In file included from /home/atrink/src/testplatzhalter4/mainwindow.cpp:2:
    /home/atrink/src/testplatzhalter4/build/Desktop_Qt_6_7_0-Debug/testplatzhalter4_autogen/include/./ui_mainwindow.h:23:10: fatal error: tabeditor.h: No such file or directory
    23 | #include <tabeditor.h>
    | ^~~~~~~~~~~~~

    The strange thing is, on Windows it works. I get this error only in Linux (Fedora).
    I also made a fresh installation via qt-unified-linux-x64-4.7.0-online.run.

    Any idea? Thanks in advance

    Pl45m4P Offline
    Pl45m4P Offline
    Pl45m4
    wrote on last edited by
    #2

    @atrink

    Where is tabEditor.h located and how you promoted the widget?


    If debugging is the process of removing software bugs, then programming must be the process of putting them in.

    ~E. W. Dijkstra

    A 1 Reply Last reply
    0
    • A atrink

      Hello!
      I created a customer widget.
      In mainwindows.ui I created a QFrame as placeholder for this customer widget.
      The class is called TabEditor and the include file is tabeditor.h.

      When compiling I get an error:
      /home/atrink/src/testplatzhalter4/build/Desktop_Qt_6_7_0-Debug/testplatzhalter4_autogen/include/ui_mainwindow.h:23: Fehler: tabeditor.h: No such file or directory
      In file included from /home/atrink/src/testplatzhalter4/mainwindow.cpp:2:
      /home/atrink/src/testplatzhalter4/build/Desktop_Qt_6_7_0-Debug/testplatzhalter4_autogen/include/./ui_mainwindow.h:23:10: fatal error: tabeditor.h: No such file or directory
      23 | #include <tabeditor.h>
      | ^~~~~~~~~~~~~

      The strange thing is, on Windows it works. I get this error only in Linux (Fedora).
      I also made a fresh installation via qt-unified-linux-x64-4.7.0-online.run.

      Any idea? Thanks in advance

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #3

      @atrink said in Build problem: can't find include file:

      #include <tabeditor.h>

      You should include your own files inside "...", not <...>. So #include "tabeditor.h". Behaviour/search path may vary across platform/compiler. Does that make it work for you?

      A 1 Reply Last reply
      1
      • JonBJ JonB

        @atrink said in Build problem: can't find include file:

        #include <tabeditor.h>

        You should include your own files inside "...", not <...>. So #include "tabeditor.h". Behaviour/search path may vary across platform/compiler. Does that make it work for you?

        A Offline
        A Offline
        atrink
        wrote on last edited by
        #4

        @JonB
        #include <tabeditor>
        is part of file ui_mainwindow.h, which is autogenerated:

        Form generated from reading UI file 'mainwindow.ui'
        Created by: Qt User Interface Compiler version 6.7.0
        WARNING! All changes made in this file will be lost when recompiling UI file!

        Don't know how to test this.

        br

        JonBJ 1 Reply Last reply
        0
        • Pl45m4P Pl45m4

          @atrink

          Where is tabEditor.h located and how you promoted the widget?

          A Offline
          A Offline
          atrink
          wrote on last edited by
          #5

          @Pl45m4

          bash:~/src/testplatzhalter4$ ls
          build CMakeLists.txt CMakeLists.txt.user main.cpp mainwindow.cpp mainwindow.h mainwindow.ui tabeditor.cpp tabeditor.h tabeditor.ui

          mainwindow.ui:
          Press on QFrame, then "Als Platzhalter für benutzerdefinierte Klasse festlegen"

          Basisklasse: QFrame
          Klassenname: TabEditor

          I also checked that upper and lowercase is correct. That's all I did.

          I would like to attach my project here. How can I attach a (zip-)file?

          Thanks!

          jsulmJ 1 Reply Last reply
          0
          • A atrink

            @Pl45m4

            bash:~/src/testplatzhalter4$ ls
            build CMakeLists.txt CMakeLists.txt.user main.cpp mainwindow.cpp mainwindow.h mainwindow.ui tabeditor.cpp tabeditor.h tabeditor.ui

            mainwindow.ui:
            Press on QFrame, then "Als Platzhalter für benutzerdefinierte Klasse festlegen"

            Basisklasse: QFrame
            Klassenname: TabEditor

            I also checked that upper and lowercase is correct. That's all I did.

            I would like to attach my project here. How can I attach a (zip-)file?

            Thanks!

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #6

            @atrink Please post your CMakeLists.txt

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            A 1 Reply Last reply
            0
            • jsulmJ jsulm

              @atrink Please post your CMakeLists.txt

              A Offline
              A Offline
              atrink
              wrote on last edited by
              #7

              @jsulm

              cmake_minimum_required(VERSION 3.5)

              project(testplatzhalter4 VERSION 0.1 LANGUAGES CXX)

              set(CMAKE_AUTOUIC ON)
              set(CMAKE_AUTOMOC ON)
              set(CMAKE_AUTORCC ON)

              set(CMAKE_CXX_STANDARD 17)
              set(CMAKE_CXX_STANDARD_REQUIRED ON)

              find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
              find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)

              set(PROJECT_SOURCES
              main.cpp
              mainwindow.cpp
              mainwindow.h
              mainwindow.ui
              tabeditor.h tabeditor.cpp tabeditor.ui
              )

              if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
              qt_add_executable(testplatzhalter4
              MANUAL_FINALIZATION
              ${PROJECT_SOURCES}
              )

              Define target properties for Android with Qt 6 as:

              set_property(TARGET testplatzhalter4 APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR

              ${CMAKE_CURRENT_SOURCE_DIR}/android)

              For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation

              else()
              if(ANDROID)
              add_library(testplatzhalter4 SHARED
              ${PROJECT_SOURCES}
              )

              Define properties for Android with Qt 5 after find_package() calls as:

              set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")

              else()
                  add_executable(testplatzhalter4
                      ${PROJECT_SOURCES}
                  )
              endif()
              

              endif()

              target_link_libraries(testplatzhalter4 PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)

              Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.

              If you are developing for iOS or macOS you should consider setting an

              explicit, fixed bundle identifier manually though.

              if(${QT_VERSION} VERSION_LESS 6.1.0)
              set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER com.example.testplatzhalter4)
              endif()
              set_target_properties(testplatzhalter4 PROPERTIES
              ${BUNDLE_ID_OPTION}
              MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
              MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
              MACOSX_BUNDLE TRUE
              WIN32_EXECUTABLE TRUE
              )

              include(GNUInstallDirs)
              install(TARGETS testplatzhalter4
              BUNDLE DESTINATION .
              LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
              RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
              )

              if(QT_VERSION_MAJOR EQUAL 6)
              qt_finalize_executable(testplatzhalter4)
              endif()

              1 Reply Last reply
              0
              • B Offline
                B Offline
                Bonnie
                wrote on last edited by
                #8

                I think you should add your source directory to include path.

                A 1 Reply Last reply
                2
                • B Bonnie

                  I think you should add your source directory to include path.

                  A Offline
                  A Offline
                  atrink
                  wrote on last edited by
                  #9

                  @Bonnie

                  I added:
                  include_directories(${CMAKE_SOURCE_DIR})

                  and now it works!
                  Thank you very much!

                  1 Reply Last reply
                  1
                  • A atrink has marked this topic as solved on
                  • A atrink

                    @JonB
                    #include <tabeditor>
                    is part of file ui_mainwindow.h, which is autogenerated:

                    Form generated from reading UI file 'mainwindow.ui'
                    Created by: Qt User Interface Compiler version 6.7.0
                    WARNING! All changes made in this file will be lost when recompiling UI file!

                    Don't know how to test this.

                    br

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by
                    #10

                    @atrink said in Build problem: can't find include file:

                    @JonB
                    #include <tabeditor>
                    is part of file ui_mainwindow.h, which is autogenerated:

                    Fair enough!

                    include_directories(${CMAKE_SOURCE_DIR})

                    It is because of the <...> in the #include that this is required!

                    A 1 Reply Last reply
                    0
                    • JonBJ JonB

                      @atrink said in Build problem: can't find include file:

                      @JonB
                      #include <tabeditor>
                      is part of file ui_mainwindow.h, which is autogenerated:

                      Fair enough!

                      include_directories(${CMAKE_SOURCE_DIR})

                      It is because of the <...> in the #include that this is required!

                      A Offline
                      A Offline
                      atrink
                      wrote on last edited by
                      #11

                      @JonB

                      Of course!
                      Can I mark a second post as "solved the problem"?

                      JonBJ 1 Reply Last reply
                      0
                      • A atrink

                        @JonB

                        Of course!
                        Can I mark a second post as "solved the problem"?

                        JonBJ Offline
                        JonBJ Offline
                        JonB
                        wrote on last edited by
                        #12

                        @atrink
                        No, and mine was not the right answer given that the <...> was auto-generated by uic, which I did not know, I just penned a quick response last night! @Bonnie was the correct one. Just I think it's useful to understand the difference between "..." and <...> going forwards :)

                        A 1 Reply Last reply
                        0
                        • JonBJ JonB

                          @atrink
                          No, and mine was not the right answer given that the <...> was auto-generated by uic, which I did not know, I just penned a quick response last night! @Bonnie was the correct one. Just I think it's useful to understand the difference between "..." and <...> going forwards :)

                          A Offline
                          A Offline
                          atrink
                          wrote on last edited by
                          #13

                          @JonB

                          Nevertheless, thank you to all of you for the quick response!
                          Great forum here!

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved