Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt Creator shows errors in fresh project, but code compiles fine

Tags:

c++

qt

qt-creator

Context: I recently switched from debian stable to debian testing so I have updated several hundred packages since the last time I used QT creator.

When I create a new project in QT creator I am greeted with many error messages.

For example, here are the errors for the autogenerated main.cpp class in a fresh project:

cstddef:50:10: fatal error: 'stddef.h' file not found
error: variable has incomplete type 'QApplication'
forward declaration of 'QApplication'
unknown type name 'MainWindow'

When I open up previous projects that I know have no errors they also show a whole bunch of similar errors.

However, all of these projects build and run just fine.

What is causing this?

like image 419
JShorthouse Avatar asked Mar 08 '20 20:03

JShorthouse


2 Answers

After seeing JShorthouse's answer, I disabled all the Clang related plugins. Then, everything started working like normal after restarting QT creator.

Find the plugins list in the menu under Help->About Plugins...

like image 91
Drist Avatar answered Sep 29 '22 19:09

Drist


I found the solution to this problem in this bug report.

The libclang-common-8-dev package needs to be installed. After installing this package and restarting qt creator all of the errors went away.

like image 37
JShorthouse Avatar answered Sep 29 '22 19:09

JShorthouse