The following is an error that has shown itself every time I have installed the Qt5 framework and the QtCreator development environment on a Linux based machine. It never mattered which flavor of Linux; QtCreator always showed this error.
Warning: The code model could not parse an included file, which might lead to incorrect code completion and highlighting, for example.
fatal error: 'stddef.h' file not found
note: in file included from /home/rlo/Code/C++/WorkTracker2/WorkTracker2Shared/src/data/taskrepository.h:1:
note: in file included from /home/rlo/Code/C++/WorkTracker2/WorkTracker2Shared/src/data/taskrepository.h:3:
note: in file included from /usr/include/c++/9/optional:38:
note: in file included from /usr/include/c++/9/stdexcept:38:
note: in file included from /usr/include/c++/9/exception:143:
note: in file included from /usr/include/c++/9/bits/exception_ptr.h:38:
Although that message never caused any issues compiling the code, I found it rather annoying, and at some point, annoying enough to search for a solution.
As it turns out, this message appears when you have Clang libraries installed. QtCreator detects that and automatically uses Clang to parse the source code and provide inline error messages and code completion.
You can get rid of this error when you explicitly add the STL header
files’ include-path to your project. In my case, I have added the
following to my *.pro
file.
unix {
INCLUDEPATH += /usr/lib/gcc/x86_64-linux-gnu/9/include
}
Thank you very much!
LikeLike
Thank you very much!
LikeLike
Thanks. This helped me too.
(As a new user of QTCreator on linux with a lot of prior experience of Visual Studio on Windows, I went looking to solve the problem myself with some way to edit the “project settings” with a visual editor of project properties, that lets you see and modify a list of include files and all kinds of other project properties.
It looks like for QTCreator, there is no such editor, and at least when you use the qmake system, you have to edit the .pro project file yourself, which you can do with reference to the documentation here: https://doc.qt.io/qt-5/qmake-project-files.html )
LikeLike