[Qt-creator] Creator Can not locate Qt Headers

Michael Jackson imikejackson at gmail.com
Sat Nov 15 04:02:07 CET 2014

On Nov 14, 2014, at 3:34 AM, Nikolai Kosjar <nikolai.kosjar at theqtcompany.com> wrote:

> Hi!
> On Thu, 13. Nov 12:36, Michael Jackson wrote:
>> The issue is that QtCreator can not seem to locate any Qt Header. There is a red squiggly line under #include <QtCore/QObject> and then none of the syntax highlighting works after that.
> Please check what the Code model gets as input from the Project
> (managers):
> 1) Open a file with unresolved includes
> 2) Open Menu: Tools > C++ > Inspect C++ Code Model
> 3) There, switch to the "Project Parts" tab and the sub tab "Header
> Paths" - check that the includes are reasonable, especially that there
> is sth. like ${PATH_TO_QT_INSTALL}/5.4/gcc_64/include/QtCore 
> Nikolai
Here are some of the include paths for the project:

/Users/Shared/Toolkits/Qt-5.3.1/lib/QtConcurrent.framework/Headers (include path)
/Users/Shared/Toolkits/Qt-5.3.1/lib/QtCore.framework/Headers (include path)
/Users/Shared/Toolkits/Qt-5.3.1/lib/QtGui.framework/Headers (include path)
/Users/Shared/Toolkits/Qt-5.3.1/lib/QtNetwork.framework/Headers (include path)
/Users/Shared/Toolkits/Qt-5.3.1/lib/QtOpenGL.framework/Headers (include path)
/Users/Shared/Toolkits/Qt-5.3.1/lib/QtPrintSupport.framework/Headers (include path)
/Users/Shared/Toolkits/Qt-5.3.1/lib/QtScript.framework/Headers (include path)
/Users/Shared/Toolkits/Qt-5.3.1/lib/QtSvg.framework/Headers (include path)
/Users/Shared/Toolkits/Qt-5.3.1/lib/QtWidgets.framework/Headers (include path)
/Users/Shared/Toolkits/Qt-5.3.1/lib/QtXml.framework/Headers (include path)

I will guess that the code model does not under stand the combination of

#include <QtCore/QObject> and that file residing in a framework on OS X. In my Qt4 build there is an actual Qt-4.8.6/include/QtCore/QObject file for the include which is why it works under Qt4. With Qt5 "proper" frameworks have been created where the headers are installed into the frameworks and QtCreator's code model just does not understand how to parse apart a framework.

I guess I could change all my #include to remove the module but that really should not be needed as the code compiles just fine the way it is (on all platforms).

Of course I could be completely wrong about all of this…

Mike Jackson

PS: Installed a Ubuntu 14.04 desktop and QtCreator and that is what I call a "proper" debugging environment. Just wish I could have that on OS X.

More information about the Qt-creator mailing list