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. In the qtest project the file cannot find the included files correctly.

In the qtest project the file cannot find the included files correctly.

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 1.4k 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.
  • Q Offline
    Q Offline
    qtpi
    wrote on last edited by
    #1

    Hi folks.

    I am working on the qtest.
    So I tried to test other class and functions by including the ".pri" file. So they are shown on the file tree on the left.

    But, I cannot include the file from the project of the ".pri" file. For example, the .pri project is "aaa.pri", then the aaa.h in this pri project cannot
    be included as the form of #include<aaa/aaa.h>

    Then I tried to include the header file in the test c++ file with a absolute/relative path, it worked: #include"../aaa/aaa.h"

    anyone got any idea?

    m.sueM 1 Reply Last reply
    0
    • Q qtpi

      Hi folks.

      I am working on the qtest.
      So I tried to test other class and functions by including the ".pri" file. So they are shown on the file tree on the left.

      But, I cannot include the file from the project of the ".pri" file. For example, the .pri project is "aaa.pri", then the aaa.h in this pri project cannot
      be included as the form of #include<aaa/aaa.h>

      Then I tried to include the header file in the test c++ file with a absolute/relative path, it worked: #include"../aaa/aaa.h"

      anyone got any idea?

      m.sueM Offline
      m.sueM Offline
      m.sue
      wrote on last edited by
      #2

      Hi @qtpi

      qmake include files (*.pri) do not implicitly set c++ include paths (which would make include "aaa/aaa.h" possible). You will have to set INCLUDEPATH yourself, see e.g. https://wiki.qt.io/Including_.pro_Files

      -Michael.

      Q 1 Reply Last reply
      1
      • m.sueM m.sue

        Hi @qtpi

        qmake include files (*.pri) do not implicitly set c++ include paths (which would make include "aaa/aaa.h" possible). You will have to set INCLUDEPATH yourself, see e.g. https://wiki.qt.io/Including_.pro_Files

        -Michael.

        Q Offline
        Q Offline
        qtpi
        wrote on last edited by
        #3

        @m.sue

        Hi.

        actually it is also included in the .pro file.
        include($$PWD/aaa/aaa.pri)

        this is also what I meant, I can see the subproject in the project tree, but in the test c++ file I cannot include the file from subproject.

        m.sueM 1 Reply Last reply
        0
        • Q qtpi

          @m.sue

          Hi.

          actually it is also included in the .pro file.
          include($$PWD/aaa/aaa.pri)

          this is also what I meant, I can see the subproject in the project tree, but in the test c++ file I cannot include the file from subproject.

          m.sueM Offline
          m.sueM Offline
          m.sue
          wrote on last edited by m.sue
          #4

          Hi @qtpi

          that line just includes the pri-file into your pro-file. But, as I said, to make #include"aaa/aaa.h" work you also have to tell the compiler where to search for the includes and add something like INCLUDEPATH+=$$PWD/aaa to your pro-file.

          -Michael.

          Q 1 Reply Last reply
          3
          • m.sueM m.sue

            Hi @qtpi

            that line just includes the pri-file into your pro-file. But, as I said, to make #include"aaa/aaa.h" work you also have to tell the compiler where to search for the includes and add something like INCLUDEPATH+=$$PWD/aaa to your pro-file.

            -Michael.

            Q Offline
            Q Offline
            qtpi
            wrote on last edited by
            #5

            @m.sue said in In the qtest project the file cannot find the included files correctly.:

            INCLUDEPATH+=$$PWD/aaa

            Thnx a lot. It worked

            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