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. Navigate to header in build dir instead of the source tree
Forum Updated to NodeBB v4.3 + New Features

Navigate to header in build dir instead of the source tree

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
5 Posts 2 Posters 798 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.
  • Aleksey_KA Offline
    Aleksey_KA Offline
    Aleksey_K
    wrote on last edited by Aleksey_K
    #1

    When I press F2 on a class name in a source which uses it QtC navigates me to the header file copied to build dir, not to the original one in the source tree. It is very annoying and leads to errors when I try to edit header copy which will be overwritten on the next build and not the original header. Also F4 on the header copy do not lead me back to the .cpp source file or wise versa: F4 from cpp goes to header in build dir, not original one. How to change this behavior? I have cmake project.

    S 1 Reply Last reply
    0
    • Aleksey_KA Aleksey_K marked this topic as a regular topic on
    • Aleksey_KA Aleksey_K

      When I press F2 on a class name in a source which uses it QtC navigates me to the header file copied to build dir, not to the original one in the source tree. It is very annoying and leads to errors when I try to edit header copy which will be overwritten on the next build and not the original header. Also F4 on the header copy do not lead me back to the .cpp source file or wise versa: F4 from cpp goes to header in build dir, not original one. How to change this behavior? I have cmake project.

      S Offline
      S Offline
      SimonSchroeder
      wrote on last edited by
      #2

      Why are you copying the header file to the build dir? Usually, this is not necessary.

      @Aleksey_K said in Navigate to header in source tree:

      navigates me to the header file copied to build dir, not to the original one in the source tree.

      Usually, this is because of the order of directories in the include search paths. I am only aware of additional preprocessor defines in QtCreator, but not separate include search paths.

      Aleksey_KA 1 Reply Last reply
      0
      • S SimonSchroeder

        Why are you copying the header file to the build dir? Usually, this is not necessary.

        @Aleksey_K said in Navigate to header in source tree:

        navigates me to the header file copied to build dir, not to the original one in the source tree.

        Usually, this is because of the order of directories in the include search paths. I am only aware of additional preprocessor defines in QtCreator, but not separate include search paths.

        Aleksey_KA Offline
        Aleksey_KA Offline
        Aleksey_K
        wrote on last edited by
        #3

        @SimonSchroeder said in Navigate to header in source tree:

        Why are you copying the header file to the build dir? Usually, this is not necessary.

        It is not me but default cmake behavior: https://stackoverflow.com/a/24725634/630169

        Inside your build directory, CMake re-creates the whole directory structure of your project.

        1 Reply Last reply
        0
        • Aleksey_KA Offline
          Aleksey_KA Offline
          Aleksey_K
          wrote on last edited by Aleksey_K
          #4

          Solved by moving build dir out from the source one:

          Initial project structure:

          + app
            ├ src
            │ ├ build
            │ │ └ Desktop_Qt_6_8_2-Debug
            │ └ CMakeLists.txt
            └ conanfile.py
          

          Current one:

          + app
            ├ build
            │ └ Desktop_Qt_6_8_2-Debug
            ├ src
            │ └ CMakeLists.txt
            └ conanfile.py
          

          This move also cleaned up the project tree from cmake generated garbage.

          1 Reply Last reply
          1
          • Aleksey_KA Aleksey_K marked this topic as a question on
          • Aleksey_KA Aleksey_K has marked this topic as solved on
          • Aleksey_KA Offline
            Aleksey_KA Offline
            Aleksey_K
            wrote on last edited by
            #5

            No, still happens.

            1 Reply Last reply
            0
            • Aleksey_KA Aleksey_K has marked this topic as unsolved on

            • Login

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