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
Forum Updated to NodeBB v4.3 + New Features

.hpp header files not shown in projects view

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
11 Posts 3 Posters 1.6k 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.
  • O Offline
    O Offline
    Omar Hatem
    wrote on last edited by
    #1

    I am using qt creator version 7.0.
    In any cmake project, when you have your header files written with extension ".hpp" it doesn't show up in the projects view in files tab.

    However, if you rename your header file to be ".h" header file it will be shown. Is there any solution or work around to this ?

    1 Reply Last reply
    0
    • O Omar Hatem

      @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.

      SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on 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
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on 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
        0
        • SGaistS SGaist

          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 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.

          SGaistS 1 Reply Last reply
          0
          • O Omar Hatem

            @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.

            SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on 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
            1
            • SGaistS SGaist

              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 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})
              
              Christian EhrlicherC 1 Reply Last reply
              0
              • O Omar Hatem

                @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})
                
                Christian EhrlicherC Offline
                Christian EhrlicherC Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on 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
                0
                • Christian EhrlicherC Christian Ehrlicher

                  @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 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?

                  Christian EhrlicherC 1 Reply Last reply
                  0
                  • O Omar Hatem

                    @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?

                    Christian EhrlicherC Offline
                    Christian EhrlicherC Offline
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on 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
                    0
                    • Christian EhrlicherC Christian Ehrlicher

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

                      O Offline
                      O Offline
                      Omar Hatem
                      wrote on 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
                      • Christian EhrlicherC Christian Ehrlicher

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

                        O Offline
                        O Offline
                        Omar Hatem
                        wrote on 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?

                        Christian EhrlicherC 1 Reply Last reply
                        0
                        • O Omar Hatem

                          @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?

                          Christian EhrlicherC Offline
                          Christian EhrlicherC Offline
                          Christian Ehrlicher
                          Lifetime Qt Champion
                          wrote on 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

                          • Login

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