Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. .hpp header files not shown in projects view

.hpp header files not shown in projects view

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
11 Posts 3 Posters 1.5k Views
  • 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.
  • S Offline
    S Offline
    SGaist
    Lifetime Qt Champion
    wrote on 22 Oct 2023, 18:56 last edited by
    #2

    Hi and welcome to devnet,

    The first thing would be to update Qt Creator to a more recent version. 7 is really outdated.

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    O 1 Reply Last reply 23 Oct 2023, 10:45
    0
    • S SGaist
      22 Oct 2023, 18:56

      Hi and welcome to devnet,

      The first thing would be to update Qt Creator to a more recent version. 7 is really outdated.

      O Offline
      O Offline
      Omar Hatem
      wrote on 23 Oct 2023, 10:45 last edited by
      #3

      @SGaist Thank you for the reply. The reason why I am using this version is because I am developing on Linux (Ubuntu 20.04 LTS). The most recent versions of qt creator have a really annoying bug; when you run the a cpp target whether it's set to "run in terminal" or not, it freezes. you have to wait for like 5 secs or more before qt creator responds again.
      In either way, the I tried the latest version, and it didn't show the ".hpp" files also.

      S 1 Reply Last reply 28 Oct 2023, 20:11
      0
      • O Omar Hatem
        23 Oct 2023, 10:45

        @SGaist Thank you for the reply. The reason why I am using this version is because I am developing on Linux (Ubuntu 20.04 LTS). The most recent versions of qt creator have a really annoying bug; when you run the a cpp target whether it's set to "run in terminal" or not, it freezes. you have to wait for like 5 secs or more before qt creator responds again.
        In either way, the I tried the latest version, and it didn't show the ".hpp" files also.

        S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 28 Oct 2023, 20:11 last edited by
        #4

        I just tested with Qt Creator 11.0.3 on macOS and the .hpp headers are properly shown.

        Might be a silly question but did you also update the CMakeLists.txt file after renaming the header file ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        O 1 Reply Last reply 30 Oct 2023, 12:04
        1
        • S SGaist
          28 Oct 2023, 20:11

          I just tested with Qt Creator 11.0.3 on macOS and the .hpp headers are properly shown.

          Might be a silly question but did you also update the CMakeLists.txt file after renaming the header file ?

          O Offline
          O Offline
          Omar Hatem
          wrote on 30 Oct 2023, 12:04 last edited by
          #5

          @SGaist Actually it works in qt creator 11.0.3 on ubuntu 20.04 LTS. But I wonder Should I add the header files one by one in cmakelists.txt?

          for example, this doesn't work.:

          set(INC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include)
          add_executable(${PROJECT_NAME}  ${SOURCES} ${INC_DIRS})
          

          but this works:

          set (HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/test.hpp)
          add_executable(${PROJECT_NAME}  ${SOURCES} ${HEADERS})
          
          C 1 Reply Last reply 30 Oct 2023, 12:06
          0
          • O Omar Hatem
            30 Oct 2023, 12:04

            @SGaist Actually it works in qt creator 11.0.3 on ubuntu 20.04 LTS. But I wonder Should I add the header files one by one in cmakelists.txt?

            for example, this doesn't work.:

            set(INC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include)
            add_executable(${PROJECT_NAME}  ${SOURCES} ${INC_DIRS})
            

            but this works:

            set (HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/test.hpp)
            add_executable(${PROJECT_NAME}  ${SOURCES} ${HEADERS})
            
            C Offline
            C Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on 30 Oct 2023, 12:06 last edited by Christian Ehrlicher
            #6

            @Omar-Hatem because add_executable() takes a list of source/header files, not directories as described in the documentation.

            Should I add the header files one by one in cmakelists.txt?

            Yes, the same goes for every source file.

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            O 1 Reply Last reply 30 Oct 2023, 12:23
            0
            • C Christian Ehrlicher
              30 Oct 2023, 12:06

              @Omar-Hatem because add_executable() takes a list of source/header files, not directories as described in the documentation.

              Should I add the header files one by one in cmakelists.txt?

              Yes, the same goes for every source file.

              O Offline
              O Offline
              Omar Hatem
              wrote on 30 Oct 2023, 12:23 last edited by
              #7

              @Christian-Ehrlicher So, I must add the header to the add_executable
              fucntion in order to work? otherwise target_include_directories won't suffice to view the header files under the headers files filter in the project view?

              C 1 Reply Last reply 30 Oct 2023, 12:29
              0
              • O Omar Hatem
                30 Oct 2023, 12:23

                @Christian-Ehrlicher So, I must add the header to the add_executable
                fucntion in order to work? otherwise target_include_directories won't suffice to view the header files under the headers files filter in the project view?

                C Offline
                C Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on 30 Oct 2023, 12:29 last edited by
                #8

                Correct. It would be very cumbersome if all headers from include_directories() would be shown there...

                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                Visit the Qt Academy at https://academy.qt.io/catalog

                O 2 Replies Last reply 30 Oct 2023, 12:50
                0
                • C Christian Ehrlicher
                  30 Oct 2023, 12:29

                  Correct. It would be very cumbersome if all headers from include_directories() would be shown there...

                  O Offline
                  O Offline
                  Omar Hatem
                  wrote on 30 Oct 2023, 12:50 last edited by
                  #9

                  @Christian-Ehrlicher @SGaist Thank you guys!

                  1 Reply Last reply
                  0
                  • O Omar Hatem has marked this topic as solved on 30 Oct 2023, 12:50
                  • C Christian Ehrlicher
                    30 Oct 2023, 12:29

                    Correct. It would be very cumbersome if all headers from include_directories() would be shown there...

                    O Offline
                    O Offline
                    Omar Hatem
                    wrote on 30 Oct 2023, 16:14 last edited by
                    #10

                    @Christian-Ehrlicher I have a question please, just to make sure, is including the header files in add_executable function makes extra overhead during compilation?

                    C 1 Reply Last reply 30 Oct 2023, 16:26
                    0
                    • O Omar Hatem
                      30 Oct 2023, 16:14

                      @Christian-Ehrlicher I have a question please, just to make sure, is including the header files in add_executable function makes extra overhead during compilation?

                      C Offline
                      C Offline
                      Christian Ehrlicher
                      Lifetime Qt Champion
                      wrote on 30 Oct 2023, 16:26 last edited by
                      #11

                      @Omar-Hatem No

                      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                      Visit the Qt Academy at https://academy.qt.io/catalog

                      1 Reply Last reply
                      1

                      11/11

                      30 Oct 2023, 16:26

                      • Login

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