Eclipse fails to locate Qt includes. Likewise, it fails to provide auto-complete functionality for Qt classes.
I did Project -> Properties -> Paths and Symbols -> Includes -> Add to the include directories of Qt in /usr/include/qt4/
. This caused Eclipse to recognize certain certain classes such as QString
; however, there is no auto-complete.
I have scoured the web to no avail. How do I make Eclipse index Qt into my project?
Edit: 12/20/12
I have solved my own problem. It appears order of the includes matter. I put
'usr/include/qt4'
'usr/include/qt4/Qt'
'usr/include/qt4/QtCore'
'usr/include/qt4/QtGui'
into Project Properties -> C++ General -> Paths & Symbols
. I rebuilt and the auto-complete worked.
You need to add several include directories, those listed by e.g. the command
pkg-config --cflags QtGui QtXml QtSvg QtDBus
(and others Qt packages).
来源:https://stackoverflow.com/questions/13927730/unresolved-inclusion-of-qt-in-eclipse