Solved In the qtest project the file cannot find the included files correctly.
-
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?
-
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.
-
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.
-
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 likeINCLUDEPATH+=$$PWD/aaa
to your pro-file.-Michael.
-
@m.sue said in In the qtest project the file cannot find the included files correctly.:
INCLUDEPATH+=$$PWD/aaa
Thnx a lot. It worked