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

Single headers not displayed

Scheduled Pinned Locked Moved Qt Creator and other tools
12 Posts 4 Posters 4.5k Views 1 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.
  • B Offline
    B Offline
    butterface
    wrote on last edited by
    #1

    Hi,

    I have a single header file in my project which I need as an interface definition. The project compiles without errors but the file is not shown in the project view. I also tried to create a new header with QtCreator which works but it is not shown in the tree. The other header where I have a cpp file as well are shown.
    How can I get the creator to display such headers?

    Thanks,
    butterface

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Anumar
      wrote on last edited by
      #2

      Does .pro file of your project contain the header name in its HEADERS section?

      1 Reply Last reply
      0
      • B Offline
        B Offline
        butterface
        wrote on last edited by
        #3

        I am using CMake but there it is in the necessary variable otherwise it would not compile.

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tobias.hunger
          wrote on last edited by
          #4

          Cmake does not require headers to be listed at all! So your code will compile, even if your headers are missing. Creator will not consider any header not listed to not be part of the project and not list it.

          1 Reply Last reply
          0
          • B Offline
            B Offline
            butterface
            wrote on last edited by
            #5

            However, the header is listed so shouldn't Creator list it then? As I mentioned above I also tried to create a header file out of Creator and there it should know that it is needed.
            It is quite complicated to switch to external editors every time I have to change those headers.

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goblincoding
              wrote on last edited by
              #6

              I have done exactly the same thing before without any issues. Have you done what Dmitry suggested and checked your .pro file to confirm that your interface file is listed under HEADERS?

              http://www.goblincoding.com

              1 Reply Last reply
              0
              • B Offline
                B Offline
                butterface
                wrote on last edited by
                #7

                As I wrote before, I don't have a .pro file, it is cmake.

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  tobias.hunger
                  wrote on last edited by
                  #8

                  Sorry, cmake syntax is just too complex for creator to fully understand it! You will have to add the files you create from inside creator to cmake manually.

                  There is just too little chance of creator putting it into the right place:-(

                  1 Reply Last reply
                  0
                  • B Offline
                    B Offline
                    butterface
                    wrote on last edited by
                    #9

                    But the thing I am a little bit worried about is, that I tried to add a header file from within Creator. So nothing with cmake or anything just New->C++-Header and it still did not show up in the list. I guess this is the same reason why the header from cmake is not shown.

                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      tobias.hunger
                      wrote on last edited by
                      #10

                      Creator extracts a list of files that belong to a project from the build system directly (.pro-file, CMakeLists.txt, Makefile.am or whatever). It does not keep any extra information around. So if your build system does not consider something as belonging to the project, then creator will not list it as such. That way what you see in creator and what your build system processes are always in sync.

                      For other build systems creator does add the files it creates using New->C++-Header, but that can not be done in a reliable way for all the build systems we support, so we do not do it everywhere. So you as a cmake user will need to make sure your headers are listed in CMakeLists.txt. Creator will not add anything there because it will most likely just mess up your build system for you:-)

                      1 Reply Last reply
                      0
                      • B Offline
                        B Offline
                        butterface
                        wrote on last edited by
                        #11

                        That sounds good so far but anyway, the file in my case is listed and the other headers where I have cpp files as well are shown and all headers are in the same variable. That's why I actually don't understand why this one is not listed.

                        1 Reply Last reply
                        0
                        • G Offline
                          G Offline
                          goblincoding
                          wrote on last edited by
                          #12

                          Apologies, I didn't quite understand the CMake angle. My bad.

                          http://www.goblincoding.com

                          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