Annotation always say that the header file not found
-
Environment: win10 x64 ltsc 2021 + visual studio 2017 + qt 5.12.12
I put SDL libs in C drive, and correctly set the environment variables in qt kits, such as INCLUDE, LIB and PATH.
Now, compiling and running are all fine, but the qtcreator always say that the header file not found, and lots of unknown type name. I've tried to disable ClangCodeModel and enable it again, but it did not work.
-
C Christian Ehrlicher moved this topic from Installation and Deployment on
-
It should be INCLUDEPATH and must be added into the pro-file: https://doc.qt.io/qt-6/qmake-variable-reference.html#includepath
Same goes for LIBS: https://doc.qt.io/qt-6/qmake-variable-reference.html#libs -
Solved by myself.
What I want is like this, I don't need to add INCLUDEPATH in pro file, nor the LIB, the PATH, only the library name, just like this:
There are 4 environment variables related:
INCLUDE/INCLUDEPATH: these 2 variables are all needed. At first I only set INCLUDE but the INCLUDEPATH was lost, so that compiling and running are fine but the annotation can not find the header file.
LIB: static library path, needed when compiling.
PATH: dynamic library path, needed when running.
Ways to set environment variables in qtcreator:
Tools, options, environment, system, environment. Here we can set the environment variables used by all kits.
Tools, options, kits, select one kit, environment. Here we cat set the environment variables used exactly by one kit.
-
It should be INCLUDEPATH and must be added into the pro-file: https://doc.qt.io/qt-6/qmake-variable-reference.html#includepath
Same goes for LIBS: https://doc.qt.io/qt-6/qmake-variable-reference.html#libs@Christian-Ehrlicher thx, but not what I wanted. I've solved this myslef.
-
The env vars are not needed at all when you properly configure the include path on the pro file...